-
Notifications
You must be signed in to change notification settings - Fork 232
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
Remove unused mapping services #794
Remove unused mapping services #794
Conversation
f4a2f2f
to
3e10c30
Compare
3e10c30
to
66b2869
Compare
<parameter key="doctrine_mongodb.odm.metadata.driver_chain.class">Doctrine\Persistence\Mapping\Driver\MappingDriverChain</parameter> | ||
<parameter key="doctrine_mongodb.odm.metadata.attribute.class">Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver</parameter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 2 parameters are no longer necessary.
<parameter key="doctrine_mongodb.odm.metadata.driver_chain.class">Doctrine\Persistence\Mapping\Driver\MappingDriverChain</parameter> | |
<parameter key="doctrine_mongodb.odm.metadata.attribute.class">Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver</parameter> |
You should also remove the assertions on this parameters in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are still necessary, the thing about how it works is that (for $driverType = 'attribute'
for example) this code:
$mappingDriverDef = new Definition($this->getMetadataDriverClass($driverType), [
array_values($driverPaths),
]);
calls to our:
protected function getMetadataDriverClass(string $driverType): string
{
return '%' . $this->getObjectManagerElementName('metadata.' . $driverType . '.class') . '%';
}
// ...
protected function getObjectManagerElementName(string $name): string
{
return 'doctrine_mongodb.odm.' . $name;
}
so it looks for %doctrine_mongodb.odm.metadata.attribute.class%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it.
Follow-up of #793
While removing annotation mapping support in #793, I've notice that these services are not necessary.
So mapping drivers are registered in
AbstractDoctrineExtension::registerMappingDrivers()
.For example for
attribute
it executes this code which in our case usesdoctrine_mongodb.odm.metadata.attribute.class
to create the AttributeDriver service.