persistence
persistence copied to clipboard
Add abstract manager registry supporting PSR-11 ContainerInterface
The current AbstractManagerRegistry
implementation provides abstract getService
and resetService
methods to allow subclasses to implement their own logic how to retrieve connection and manager services. However, with PSR-11 defining a lightweight container interface, I believe it's best to deprecate AbstractManagerRegistry
in favour of a ContainerManagerRegistry
that takes a ContainerInterface
in the constructor and forwards all calls to the ContainerInterface::get
.
A basic example implementation for this would be the ManagerRegistry
provided in the Symfony DoctrineBridge: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/ManagerRegistry.php. There is some dark magic going on with resetService
, where we'd have to discuss how to best solve this. Not sure why we need resetting services, but again, this shouldn't be an implementation detail of an abstract registry.
This new class could be added in 1.2 with the AbstractManagerRegistry
potentially being deprecated in either the same release or in a subsequent 2.x release.