Skip to content

Commit 594addb

Browse files
authored
Merge pull request #1954 from greg0ire/no-rfwd
Forget about report_fields_where_declared
2 parents 7d10d76 + 7c0a82c commit 594addb

File tree

15 files changed

+24
-137
lines changed

15 files changed

+24
-137
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 & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Doctrine\Bundle\DoctrineBundle\DependencyInjection;
44

55
use Doctrine\DBAL\Schema\LegacySchemaManagerFactory;
6-
use Doctrine\Deprecations\Deprecation;
76
use Doctrine\ORM\EntityManager;
87
use Doctrine\ORM\EntityRepository;
98
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -670,26 +669,6 @@ private function getOrmEntityManagersNode(): ArrayNodeDefinition
670669
->arrayNode('schema_ignore_classes')
671670
->prototype('scalar')->end()
672671
->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()
693672
->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()
694673
->end()
695674
->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 & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
1313
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1414
use Doctrine\DBAL\Schema\LegacySchemaManagerFactory;
15-
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
1615
use Doctrine\ORM\EntityManager;
1716
use Doctrine\ORM\EntityManagerInterface;
1817
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -28,7 +27,6 @@
2827
use Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator;
2928
use Symfony\Component\Cache\Adapter\ArrayAdapter;
3029
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
31-
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
3230
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
3331
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
3432
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -57,8 +55,6 @@
5755

5856
abstract class AbstractDoctrineExtensionTestCase extends TestCase
5957
{
60-
use VerifyDeprecations;
61-
6258
abstract protected function loadFromFile(ContainerBuilder $container, string $file): void;
6359

6460
public function testDbalLoadFromXmlMultipleConnections(): void
@@ -562,7 +558,6 @@ public function testSingleEntityManagerMultipleMappingBundleDefinitions(): void
562558
[
563559
__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'Bundles' . DIRECTORY_SEPARATOR . 'AttributesBundle' . DIRECTORY_SEPARATOR . 'Entity',
564560
],
565-
true,
566561
]);
567562

568563
$xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver');
@@ -915,33 +910,6 @@ public function testDisablingLazyGhostOnOrm3Throws(): void
915910
$this->loadContainer('orm_no_lazy_ghost');
916911
}
917912

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-
945913
public function testResolveTargetEntity(): void
946914
{
947915
if (! interface_exists(EntityManagerInterface::class)) {

tests/DependencyInjection/Compiler/IdGeneratorPassTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures\CustomIdGenerator;
88
use Doctrine\ORM\Configuration;
99
use Doctrine\ORM\EntityManagerInterface;
10-
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
1110
use Fixtures\Bundles\AttributesBundle\AttributesBundle;
1211
use Fixtures\Bundles\AttributesBundle\Entity\TestCustomIdGeneratorEntity as AttributeCustomIdGeneratorEntity;
1312
use PHPUnit\Framework\TestCase;
@@ -16,7 +15,6 @@
1615
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
1716

1817
use function assert;
19-
use function class_exists;
2018
use function interface_exists;
2119
use function method_exists;
2220
use function sys_get_temp_dir;
@@ -93,7 +91,7 @@ public function testRepositoryServiceWiring(): void
9391
'enable_lazy_ghost_objects' => true,
9492
/** @phpstan-ignore function.alreadyNarrowedType */
9593
'enable_native_lazy_objects' => PHP_VERSION_ID >= 80400 && method_exists(Configuration::class, 'enableNativeLazyObjects'),
96-
] + (class_exists(AnnotationDriver::class) ? ['report_fields_where_declared' => true] : []),
94+
],
9795
],
9896
], $container);
9997

tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ public function testAttributesBundleMappingDetection(): void
811811
'mappings' => [
812812
'AttributesBundle' => ['type' => 'attribute'],
813813
],
814-
] + (class_exists(AnnotationDriver::class) ? ['report_fields_where_declared' => true] : []),
814+
],
815815
],
816816
])
817817
->build();

tests/DependencyInjection/Fixtures/TestKernel.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
66
use Doctrine\ORM\Configuration;
7-
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
87
use Psr\Log\NullLogger;
98
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
109
use Symfony\Component\Config\Loader\LoaderInterface;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
1211
use Symfony\Component\HttpKernel\Bundle\Bundle;
1312
use Symfony\Component\HttpKernel\Kernel;
1413

15-
use function class_exists;
1614
use function md5;
1715
use function method_exists;
1816
use function mt_rand;
@@ -64,7 +62,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
6462
'prefix' => 'Fixtures\Bundles\RepositoryServiceBundle\Entity',
6563
],
6664
],
67-
] + (class_exists(AnnotationDriver::class) ? ['report_fields_where_declared' => true] : []),
65+
],
6866
]);
6967

7068
// Register a NullLogger to avoid getting the stderr default logger of FrameworkBundle

0 commit comments

Comments
 (0)