A
A
Anton Ivanov2014-08-16 08:45:36
symfony
Anton Ivanov, 2014-08-16 08:45:36

Is it possible to inject your own EntityManager and twig into symfony2?

Hello.
There is a platform with its own init scripts, a set of custom functions for doctrine, filters for twig and other preferences and poets.
Now a site written in symfony is being added to this platform. The question is, is it possible to pass "self-created" EntityManager and Twig_Environment instances to symfony?
They can, of course, be used as global variables. But, if in the case of EntityManager, it still "rolls", then with Twig it is already more difficult.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-08-16
Protko @Fesor

Um ... why do you need an EntityManager in twig?
In general, you can do anything, you just need to inject an entity manager extension or a factory of these into twig and build your own (although it’s better to entrust this to DI as well).
But somehow it seems to me that having an entity manager instance in Twig is somehow not right ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question