Difference between ObjectManager and EntityManager in Symfony2? Difference between ObjectManager and EntityManager in Symfony2? symfony symfony

Difference between ObjectManager and EntityManager in Symfony2?


ObjectManager is an interface and EntityManager is its ORM implementation. It's not the only implementation; for example, DocumentManager from MongoDB ODM implements it as well. ObjectManager provides only the common subset of all its implementations.

If you want your form type to work with any ObjectManager implementation, then use it. This way you could switch from ORM to ODM and your type would still work the same. But if you need something specific that only EntityManager provides and aren't planning to switch to ODM, use it instead.