mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #238] Add Configuration::setDefaultMetadataDriverImpl() method for convenience. #7907
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/238
State: closed
Merged: No
Current logic to setup Doctrine2 is a bit cluttered, because there's a circular dependency between $config and $driverImpl, which makes it impossible to configure things in Dependency Injection container.
Configuration is not fully initialized (and not added to service map) when setMetadataDriverImpl is called, but then setMetadataDriverImpl needs to call Configuration's newDefaultAnnotationDriver. Dependency deadlock.
I think that simpliest way to solve is to introduce setDefaultMetadataDriverImpl() method like this:
If you use non-default driver, you need to define everything explicitly anyway.
For default one, now you need to read annotations class and copy logic from newDefaultAnnotationDriver to DI container map on your own.