-
-
Notifications
You must be signed in to change notification settings - Fork 77
Description
Hi,
i think i found a conceptional bug with the Service Definition of the object manager persister:
<service id="fidry_alice_data_fixtures.persistence.persister.doctrine.object_manager_persister"
class="Fidry\AliceDataFixtures\Bridge\Doctrine\Persister\ObjectManagerPersister"
lazy="true">
<argument type="service" id="doctrine.orm.entity_manager" />
</service>Having this service definition a persist(object) in the Fidry\AliceDataFixtures\Loader\PersisterLoader::load causes the object to be not persistet to the database if it is not in the entity namespace of the default object manager. This is because doctrine.orm.entity_manager is an alias for the default connection.
One solution would be to add all existing entity managers to the \Fidry\AliceDataFixtures\Bridge\Doctrine\Persister\ObjectManagerPersister and determine by the getPersistableClasses method which object manager is used for persisting. The only problem with this solution is that an entity can be used in multiple managers. But this may be one of the more rare cases i guess...