Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb0817c

Browse files
bug #53681 [DoctrineBridge]  Fix detection of Xml/Yaml driver in DoctrineExtension (GromNaN)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [DoctrineBridge]  Fix detection of Xml/Yaml driver in DoctrineExtension | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix doctrine/DoctrineMongoDBBundle#841 | License | MIT In DoctrineMongoDBBundle v5, we removed `.class` attributes to plain class names in service definitions (see doctrine/DoctrineMongoDBBundle#821). The class for `doctrine_mongodb.odm.default_xml_metadata_driver` changed from `doctrine_mongodb.odm.metadata.xml.class` to `Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver`. I fixed the detection of the driver by checking the uppercase `Xml` and `Yaml` because it might be necessary if the same change is made to DoctrineBundle. [`doctrine/mongodb-odm-bundle` requires `symfony/doctrine-bridge: "^6.4 || ^7.0"`](https://github.com/doctrine/DoctrineMongoDBBundle/blob/4d8d32b726e7af21a562a2b6a227f0496c7d39d5/composer.json#L36) so this patch if not required for older versions of Symfony even if it could be applied. Commits ------- 662b8f2 [DoctrineBridge]  Fix detection of Xml/Yaml driver in DoctrineExtension
2 parents cb68bf3 + 662b8f2 commit cb0817c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ protected function registerMappingDrivers(array $objectManager, ContainerBuilder
215215
array_values($driverPaths),
216216
]);
217217
}
218-
if (str_contains($mappingDriverDef->getClass(), 'yml') || str_contains($mappingDriverDef->getClass(), 'xml')) {
218+
if (str_contains($mappingDriverDef->getClass(), 'yml') || str_contains($mappingDriverDef->getClass(), 'xml')
219+
|| str_contains($mappingDriverDef->getClass(), 'Yaml') || str_contains($mappingDriverDef->getClass(), 'Xml')
220+
) {
219221
$mappingDriverDef->setArguments([array_flip($driverPaths)]);
220222
$mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']);
221223
}

0 commit comments

Comments
 (0)