doctrine / doctrine/persistence
Add abstract manager registry supporting PSR-11 ContainerInterface
- Dominant language
- PHP
- Stars
- 4k
- Forks
- 76
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.