remove container aware interface from timeline builder

This commit is contained in:
Julien Fastré 2023-10-02 15:03:05 +02:00
parent 6a37079ee5
commit 41f4bbfdce
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 4 additions and 10 deletions

View File

@ -14,21 +14,19 @@ namespace Chill\MainBundle\Timeline;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\ResultSetMapping;
use LogicException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Twig\Environment;
use function array_key_exists;
use function is_string;
/**
* Build timeline.
*/
class TimelineBuilder implements ContainerAwareInterface
class TimelineBuilder
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Record provider.
*
@ -45,7 +43,7 @@ class TimelineBuilder implements ContainerAwareInterface
*/
private array $providersByContext = [];
public function __construct(private readonly EntityManagerInterface $em) {}
public function __construct(private readonly EntityManagerInterface $em, private readonly Environment $twig) {}
/**
* add a provider id.
@ -291,7 +289,7 @@ class TimelineBuilder implements ContainerAwareInterface
];
}
return $this->container->get('templating')
return $this->twig
->render('@ChillMain/Timeline/chain_timelines.html.twig', [
'results' => $timelineEntries,
]);

View File

@ -5,10 +5,6 @@ services:
chill_main.timeline_builder:
class: Chill\MainBundle\Timeline\TimelineBuilder
arguments:
- "@doctrine.orm.entity_manager"
calls:
- [ setContainer, ["@service_container"]]
# alias:
Chill\MainBundle\Timeline\TimelineBuilder: '@chill_main.timeline_builder'