-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple ObjectManagers with doctrine #90
Comments
Hello. If you can find a way generic enough for persisting the entities with multiple object managers I'm happy to merge that solution. Meanwhile, an easy way to fix it is to override the object manager persister service definition to inject the desired entity manager. |
Hello, When do you think it would be possible to play with several entity managers ? Thank you |
@jdlabails as stated in my previous comment, I'm still unsure on how it should be implemented. As for the workaround, the library currently relies on an object manager persister service: you can create your own instead to use multiple managers instead of just the default one |
Hi,
i think i found a conceptional bug with the Service Definition of the object manager persister:
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...
The text was updated successfully, but these errors were encountered: