Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected function getMappingDriverBundleConfigDefaults(
}

if (! $bundleConfig['dir']) {
if (in_array($bundleConfig['type'], ['staticphp', 'attribute'])) {
if (in_array($bundleConfig['type'], ['attribute'])) {
$bundleConfig['dir'] = $bundleClassDir . '/' . $this->getMappingObjectDefaultName();
} else {
$bundleConfig['dir'] = $bundleDir . '/' . $this->getMappingResourceConfigDirectory($bundleDir);
Expand Down Expand Up @@ -279,10 +279,6 @@ protected function registerMappingDrivers(array $objectManager, ContainerBuilder
}

$mappingDriverDef->setArguments($args);
} elseif ($driverType === 'attribute') {
$mappingDriverDef = new Definition($this->getMetadataDriverClass($driverType), [
array_values($driverPaths),
]);
} else {
$mappingDriverDef = new Definition($this->getMetadataDriverClass($driverType), [
array_values($driverPaths),
Expand Down Expand Up @@ -325,8 +321,8 @@ protected function assertValidMappingConfiguration(
throw new InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
}

if (! in_array($mappingConfig['type'], ['xml', 'php', 'staticphp', 'attribute'])) {
Copy link
Member Author

@GromNaN GromNaN Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using php or static php currently fails in

protected function getMetadataDriverClass(string $driverType): string
{
return match ($driverType) {
'driver_chain' => MappingDriverChain::class,
'attribute' => AttributeDriver::class,
'xml' => XmlDriver::class,
default => throw new InvalidArgumentException(sprintf('Metadata driver not supported: "%s"', $driverType))
};
}

throw new InvalidArgumentException(sprintf('Can only configure "xml", "yml", "php", "staticphp" or "attribute" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. You can register them by adding a new driver to the "%s" service definition.', $this->getObjectManagerElementName($objectManagerName . '_metadata_driver')));
if (! in_array($mappingConfig['type'], ['xml', 'attribute'])) {
throw new InvalidArgumentException(sprintf('Can only configure "xml" or "attribute" through the DoctrineMongoDBBundle. Use your own bundle to configure other metadata drivers. You can register them by adding a new driver to the "%s" service definition.', $this->getObjectManagerElementName($objectManagerName . '_metadata_driver')));
}
}

Expand Down