diff --git a/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php b/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php index 08f16299b2..e4818f31f7 100644 --- a/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php +++ b/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php @@ -25,10 +25,19 @@ class RenderContextListener * @param EngineInterface $templating * @param EntityManagerInterface $em */ - public function __construct(EngineInterface $templating, EntityManagerInterface $em) + public function __construct(/* EngineInterface|EntityManagerInterface */ $em, EntityManagerInterface $emOld = null) { - $this->templating = $templating; - $this->em = $em; + if ($em instanceof EngineInterface) { + // NEXT_MAJOR Also remove the symfony/templating dependency as it is unused after the removal of the templating parameter. + @trigger_error(sprintf('Passing a templating engine as the first argument of "%s" is deprecated since KunstmaanNodeBundle 5.1 and will be removed in KunstmaanNodeBundle 6.0. Remove the template engine service argument.', __METHOD__), E_USER_DEPRECATED); + + $this->templating = $em; + $this->em = $emOld; + + return; + } + + $this->em = $em; } /** diff --git a/src/Kunstmaan/NodeBundle/Resources/config/services.yml b/src/Kunstmaan/NodeBundle/Resources/config/services.yml index 278b3efc80..97357773dd 100644 --- a/src/Kunstmaan/NodeBundle/Resources/config/services.yml +++ b/src/Kunstmaan/NodeBundle/Resources/config/services.yml @@ -159,7 +159,7 @@ services: kunstmaan_node.render.context.listener: class: Kunstmaan\NodeBundle\EventListener\RenderContextListener - arguments: ['@templating', '@doctrine.orm.entity_manager'] + arguments: ['@doctrine.orm.entity_manager'] tags: - { name: kernel.event_listener, event: kernel.view, method: onKernelView }