GetEntityManager in Symfony 3.0.6

1

Since version 3.0.6 they have permanently deleted (removed) the getEntityManager () method and it is now getManager ().

If you are using version 3.0.0 you will not have problems, but with version 3.0.6 or higher Symfony realizes that when we do it

$ Em = $ this-> getDoctrine () -> getEntityManager ()

In an action you must change it to this

$ Em = $ this-> getDoctrine () -> getManager ();

To work correctly

Is it possible to continue using getEntityManager () in versions 3.0.6 or higher?

Place the question in the English version: link but I would like to know your criteria.

Greetings

    
asked by juanitourquiza 13.01.2017 в 14:21
source

1 answer

2

No. You can not keep using it.

There are ways to keep this method in use if you do not want to go replacing the name in all the files where you use it (which I would recommend doing this)

The usual thing is that you overwrite the "doctrine" service with your own class, which inherits from the class Doctrine\Bundle\DoctrineBundle\Registry , generate the method in question and pass it to the getManager. However, I do not recommend it ... Ideally, update your code and keep it up to date.

    
answered by 16.01.2017 в 12:25