Skip to content

Commit 6c8318b

Browse files
Merge branch '4.4' into 5.2
* 4.4: [DoctrineBridge] Allow bundles to define a driver type "attribute" fix test SocketStreamTest for Windows Fix issue with RequestMatcher when attribute is a closure [PropertyInfo] Use the right context for methods defined in traits
2 parents 72b6d74 + 9d42bb1 commit 6c8318b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \Re
146146
}
147147

148148
if (!$bundleConfig['dir']) {
149-
if (\in_array($bundleConfig['type'], ['annotation', 'staticphp'])) {
149+
if (\in_array($bundleConfig['type'], ['annotation', 'staticphp', 'attribute'])) {
150150
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName();
151151
} else {
152152
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory();
@@ -186,6 +186,10 @@ protected function registerMappingDrivers(array $objectManager, ContainerBuilder
186186
$args[0] = array_merge(array_values($driverPaths), $args[0]);
187187
}
188188
$mappingDriverDef->setArguments($args);
189+
} elseif ('attribute' === $driverType) {
190+
$mappingDriverDef = new Definition($this->getMetadataDriverClass($driverType), [
191+
array_values($driverPaths),
192+
]);
189193
} elseif ('annotation' == $driverType) {
190194
$mappingDriverDef = new Definition($this->getMetadataDriverClass($driverType), [
191195
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
@@ -227,8 +231,8 @@ protected function assertValidMappingConfiguration(array $mappingConfig, string
227231
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
228232
}
229233

230-
if (!\in_array($mappingConfig['type'], ['xml', 'yml', 'annotation', 'php', 'staticphp'])) {
231-
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or "staticphp" 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')));
234+
if (!\in_array($mappingConfig['type'], ['xml', 'yml', 'annotation', 'php', 'staticphp', 'attribute'])) {
235+
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "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')));
232236
}
233237
}
234238

0 commit comments

Comments
 (0)