From 41f4bbfdce0522ceffaec1336a411fa537b2f246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 2 Oct 2023 15:03:05 +0200 Subject: [PATCH] remove container aware interface from timeline builder --- .../ChillMainBundle/Timeline/TimelineBuilder.php | 10 ++++------ .../ChillMainBundle/config/services/timeline.yaml | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index 75d513901..467409c21 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -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, ]); diff --git a/src/Bundle/ChillMainBundle/config/services/timeline.yaml b/src/Bundle/ChillMainBundle/config/services/timeline.yaml index 7b7987f5a..96feac5cd 100644 --- a/src/Bundle/ChillMainBundle/config/services/timeline.yaml +++ b/src/Bundle/ChillMainBundle/config/services/timeline.yaml @@ -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'