Skip to content

Commit 2bd23e1

Browse files
committed
Add a new report_fields_where_declared config setting
This adds a new config setting `report_fields_where_declared` that shall make it easier for users to address a deprecation added in Doctrine ORM 2.16, more specifically in doctrine/orm#10455. I think that since this bundle allows to specify the mapping configuration per entity manager, it would make sense to have this new config setting at the entity manager level as well.
1 parent e6da248 commit 2bd23e1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

DependencyInjection/Configuration.php

+1
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ private function getOrmEntityManagersNode(): ArrayNodeDefinition
628628
->arrayNode('schema_ignore_classes')
629629
->prototype('scalar')->end()
630630
->end()
631+
->scalarNode('report_fields_where_declared')->defaultFalse()->end()
631632
->end()
632633
->children()
633634
->arrayNode('second_level_cache')

DependencyInjection/DoctrineExtension.php

+15
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,21 @@ protected function loadOrmEntityManagerMappingInformation(array $entityManager,
820820
$this->loadMappingInformation($entityManager, $container);
821821
$this->registerMappingDrivers($entityManager, $container);
822822

823+
$chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($entityManager['name'].'_metadata_driver'));
824+
foreach (array_keys($this->drivers) as $driverType) {
825+
$mappingService = $this->getObjectManagerElementName($entityManager['name'].'_'.$driverType.'_metadata_driver');
826+
$mappingDriverDef = $container->getDefinition($mappingService);
827+
$args = $mappingDriverDef->getArguments();
828+
if ('annotation' == $driverType) {
829+
$args[2] = $entityManager['report_fields_where_declared'];
830+
} else if ('attribute' == $driverType) {
831+
$args[1] = $entityManager['report_fields_where_declared'];
832+
} else {
833+
continue;
834+
}
835+
$mappingDriverDef->setArguments($args);
836+
}
837+
823838
$ormConfigDef->addMethodCall('setEntityNamespaces', [$this->aliasMap]);
824839
}
825840

0 commit comments

Comments
 (0)