Skip to content

Commit 4117427

Browse files
committed
Forget about report_fields_where_declared
With ORM 3, it is a no-op, we no longer need to offer the possibility to configure it.
1 parent 7d10d76 commit 4117427

File tree

9 files changed

+20
-98
lines changed

9 files changed

+20
-98
lines changed

UPGRADE-3.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ and does not have a replacement.
4141
Configuration
4242
-------------
4343

44+
### The `doctrine.orm.entity_managers.some_em.report_fields_where_declared` configuration option has been removed
45+
46+
This option is a no-op when using `doctrine/orm` 3 and has been removed.
47+
4448
### The `doctrine.dbal.default_table_options.collate` default table option is removed
4549

4650
Use `doctrine.dbal.default_table_options.collation` instead.

config/schema/doctrine-1.0.xsd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@
234234
<xsd:attribute name="typed-field-mapper" type="xsd:string" />
235235
<xsd:attribute name="entity-listener-resolver" type="xsd:string" />
236236
<xsd:attribute name="repository-factory" type="xsd:string" />
237-
<xsd:attribute name="report-fields-where-declared" type="xsd:boolean" />
238237
<xsd:attribute name="validate-xml-mapping" type="xsd:boolean" />
239238
</xsd:attributeGroup>
240239

docs/en/configuration.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ Configuration Reference
258258
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
259259
default_repository_class: Doctrine\ORM\EntityRepository
260260
auto_mapping: false
261-
# Opt-in to new mapping driver mode as of Doctrine ORM 2.16, https://github.com/doctrine/orm/pull/10455
262-
report_fields_where_declared: false
263261
# 0pt-in to the new mapping driver mode as of Doctrine ORM 2.14. See https://github.com/doctrine/orm/pull/6728.
264262
validate_xml_mapping: false
265263
naming_strategy: doctrine.orm.naming_strategy.default
@@ -513,7 +511,6 @@ Configuration Reference
513511
class-metadata-factory-name="Doctrine\ORM\Mapping\ClassMetadataFactory"
514512
default-repository-class="Doctrine\ORM\EntityRepository"
515513
auto-mapping="false"
516-
report-fields-where-declared="false"
517514
naming-strategy="doctrine.orm.naming_strategy.default"
518515
quote-strategy="doctrine.orm.quote_strategy.default"
519516
typed-field-mapper="doctrine.orm.typed_field_mapper.default"
@@ -671,7 +668,6 @@ the ORM resolves to:
671668
metadata_cache_driver: ~
672669
query_cache_driver: ~
673670
result_cache_driver: ~
674-
report_fields_where_declared: false
675671
676672
There are lots of other configuration options that you can use to overwrite
677673
certain classes, but those are for very advanced use-cases only.

src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,22 @@ public static function createPhpMappingDriver(array $namespaces, array $managerP
116116
}
117117

118118
/**
119-
* @param string[] $namespaces List of namespaces that are handled with attribute mapping
120-
* @param string[] $directories List of directories to look for classes with attributes
121-
* @param string[] $managerParameters List of parameters that could which object manager name
122-
* your bundle uses. This compiler pass will automatically
123-
* append the parameter name for the default entity manager
124-
* to this list.
125-
* @param string|false $enabledParameter Service container parameter that must be present to
126-
* enable the mapping. Set to false to not do any check,
127-
* optional.
128-
* @param string[] $aliasMap Map of alias to namespace.
129-
* @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared
119+
* @param string[] $namespaces List of namespaces that are handled with attribute mapping
120+
* @param string[] $directories List of directories to look for classes with attributes
121+
* @param string[] $managerParameters List of parameters that could which object manager name
122+
* your bundle uses. This compiler pass will automatically
123+
* append the parameter name for the default entity manager
124+
* to this list.
125+
* @param string|false $enabledParameter Service container parameter that must be present to
126+
* enable the mapping. Set to false to not do any check,
127+
* optional.
128+
* @param string[] $aliasMap Map of alias to namespace.
130129
*
131130
* @return self
132131
*/
133-
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false)
132+
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [])
134133
{
135-
$driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]);
134+
$driver = new Definition(AttributeDriver::class, [$directories]);
136135

137136
return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
138137
}

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -670,26 +670,6 @@ private function getOrmEntityManagersNode(): ArrayNodeDefinition
670670
->arrayNode('schema_ignore_classes')
671671
->prototype('scalar')->end()
672672
->end()
673-
->booleanNode('report_fields_where_declared')
674-
->beforeNormalization()
675-
->ifTrue(static fn ($v): bool => isset($v))
676-
->then(static function ($v) {
677-
Deprecation::trigger(
678-
'doctrine/doctrine-bundle',
679-
'https://github.com/doctrine/DoctrineBundle/pull/1962',
680-
'The "report_fields_where_declared" configuration option is deprecated and will be removed in DoctrineBundle 3.0. When using ORM 3, report_fields_where_declared will always be true.',
681-
);
682-
683-
return $v;
684-
})
685-
->end()
686-
->defaultValue(true)
687-
->info('Set to "true" to opt-in to the new mapping driver mode that was added in Doctrine ORM 2.16 and will be mandatory in ORM 3.0. See https://github.com/doctrine/orm/pull/10455.')
688-
->validate()
689-
->ifTrue(static fn (bool $v): bool => ! $v)
690-
->thenInvalid('The setting "report_fields_where_declared" cannot be disabled for ORM 3.')
691-
->end()
692-
->end()
693673
->booleanNode('validate_xml_mapping')->defaultFalse()->info('Set to "true" to opt-in to the new mapping driver mode that was added in Doctrine ORM 2.14 and will be mandatory in ORM 3.0. See https://github.com/doctrine/orm/pull/6728.')->end()
694674
->end()
695675
->children()

src/DependencyInjection/DoctrineExtension.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -871,15 +871,13 @@ protected function loadOrmEntityManagerMappingInformation(array $entityManager,
871871
$mappingService = $this->getObjectManagerElementName($entityManager['name'] . '_' . $driverType . '_metadata_driver');
872872
$mappingDriverDef = $container->getDefinition($mappingService);
873873
$args = $mappingDriverDef->getArguments();
874-
if ($driverType === 'attribute') {
875-
$args[1] = $entityManager['report_fields_where_declared'];
876-
} elseif ($driverType === 'xml') {
877-
$args[1] ??= SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION;
878-
$args[2] = $entityManager['validate_xml_mapping'];
879-
} else {
874+
if ($driverType !== 'xml') {
880875
continue;
881876
}
882877

878+
$args[1] ??= SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION;
879+
$args[2] = $entityManager['validate_xml_mapping'];
880+
883881
$mappingDriverDef->setArguments($args);
884882
}
885883

tests/DependencyInjection/AbstractDoctrineExtensionTestCase.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator;
2929
use Symfony\Component\Cache\Adapter\ArrayAdapter;
3030
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
31-
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
3231
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
3332
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
3433
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -562,7 +561,6 @@ public function testSingleEntityManagerMultipleMappingBundleDefinitions(): void
562561
[
563562
__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'Bundles' . DIRECTORY_SEPARATOR . 'AttributesBundle' . DIRECTORY_SEPARATOR . 'Entity',
564563
],
565-
true,
566564
]);
567565

568566
$xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver');
@@ -915,33 +913,6 @@ public function testDisablingLazyGhostOnOrm3Throws(): void
915913
$this->loadContainer('orm_no_lazy_ghost');
916914
}
917915

918-
/** @group legacy */
919-
public function testDisablingReportFieldsWhereDeclaredOnOrm3Throws(): void
920-
{
921-
if (! interface_exists(EntityManagerInterface::class)) {
922-
self::markTestSkipped('This test requires ORM');
923-
}
924-
925-
$this->expectException(InvalidConfigurationException::class);
926-
$this->expectExceptionMessage('Invalid configuration for path "doctrine.orm.entity_managers.default.report_fields_where_declared": The setting "report_fields_where_declared" cannot be disabled for ORM 3.');
927-
$this->loadContainer('orm_no_report_fields');
928-
}
929-
930-
/** @group legacy */
931-
public function testEnablingReportFieldsWhereDeclaredOnOrm3IsDeprecated(): void
932-
{
933-
if (! interface_exists(EntityManagerInterface::class)) {
934-
self::markTestSkipped('This test requires ORM');
935-
}
936-
937-
if (class_exists(AnnotationDriver::class)) {
938-
self::markTestSkipped('This test requires ORM 3.');
939-
}
940-
941-
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/DoctrineBundle/pull/1962');
942-
$this->loadContainer('orm_report_fields');
943-
}
944-
945916
public function testResolveTargetEntity(): void
946917
{
947918
if (! interface_exists(EntityManagerInterface::class)) {

tests/DependencyInjection/Fixtures/config/xml/orm_no_report_fields.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/DependencyInjection/Fixtures/config/yml/orm_no_report_fields.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)