Open VincentLanglet opened 1 year ago
Deprecate calling fromConnection()
without passing an event manager?
Seems like EntityManagerInterface::getEventManager
exists ; I'll try this instead.
Seems like
EntityManagerInterface::getEventManager
exists ; I'll try this instead.
Yes, but that'll only work if you have an entity manager. You can use migrations with a connection only.
fromConnection
should indeed allow passing an EventManager explicitly, using Connection::getEventManager
only as fallback (triggering a deprecation telling you to pass an EventManager explicitly).
fromEntityManager
would register the EventManager using the ORM EventManager.
DependencyFactory::getEventDispatcher
would then use a DependencyFactory::getEventManager
method reading the configured event manager.
DoctrineCommand is doing DependencyFactory::fromConnection
does it mean we have to add EventManager
to the constructor of all doctrine command ?
To be compatible with CLI commands, we might need a concept of an event manager loader instead of passing directly an event manager.
Bug Report
Summary
DependencyFactory::getEventDispatcher
is implemented this way:but
Connection::getEventManager
is deprecated by dbal since https://github.com/doctrine/dbal/issues/5784Not sure how to fix this @greg0ire @derrabus