diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 450dbd3d7..e03bf5774 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -21,7 +21,6 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Id\AbstractIdGenerator; -use Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver; use Doctrine\ORM\Proxy\Autoloader; use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand; use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand; @@ -64,7 +63,6 @@ use function array_intersect_key; use function array_keys; use function class_exists; -use function count; use function interface_exists; use function is_dir; use function method_exists; @@ -785,7 +783,6 @@ protected function loadOrmEntityManagerMappingInformation(array $entityManager, $this->loadMappingInformation($entityManager, $container); $this->registerMappingDrivers($entityManager, $container); - $this->enableXmlMappingDriverXsdValidation($entityManager['name'], $container); $ormConfigDef->addMethodCall('setEntityNamespaces', [$this->aliasMap]); } @@ -1132,32 +1129,4 @@ private function useMiddlewaresIfAvailable( ->addTag('doctrine.middleware', ['connection' => $connName]); } } - - /** - * TODO: remove this once we dropped support for ORM < 3.0 - */ - private function enableXmlMappingDriverXsdValidation(string $managerName, ContainerBuilder $container): void - { - $xmlDriverId = sprintf('doctrine.orm.%s_xml_metadata_driver', $managerName); - - if (! $container->hasDefinition($xmlDriverId)) { - return; - } - - $xmlDriverDef = $container->getDefinition($xmlDriverId); - $args = $xmlDriverDef->getArguments(); - $numberOfArgs = count($args); - if ($numberOfArgs === 0 || $numberOfArgs === 3) { - return; - } - - if ($numberOfArgs < 2) { - $args[] = SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION; - } - - // enable validation - $args[] = true; - - $xmlDriverDef->setArguments($args); - } } diff --git a/Tests/ContainerTest.php b/Tests/ContainerTest.php index 72d5a9c4d..54a6b26b3 100644 --- a/Tests/ContainerTest.php +++ b/Tests/ContainerTest.php @@ -59,10 +59,6 @@ public function testContainer(): void $this->assertInstanceOf(InfoCommand::class, $container->get('doctrine.mapping_info_command')); $this->assertInstanceOf(UpdateCommand::class, $container->get('doctrine.schema_update_command')); - $xmlDriverDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver'); - $this->assertCount(3, $xmlDriverDef->getArguments()); - $this->assertTrue($xmlDriverDef->getArguments()[2]); - $this->assertTrue(Type::hasType('test')); $this->assertFalse($container->has('doctrine.dbal.default_connection.events.mysqlsessioninit')); diff --git a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index 281570d21..2c8989d01 100644 --- a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -15,7 +15,6 @@ use Doctrine\DBAL\Schema\LegacySchemaManagerFactory; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver; use Generator; use InvalidArgumentException; use PDO; @@ -510,8 +509,6 @@ public function testSingleEntityManagerMultipleMappingBundleDefinitions(): void $xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver'); $this->assertDICConstructorArguments($xmlDef, [ [__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'Bundles' . DIRECTORY_SEPARATOR . 'XmlBundle' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'doctrine' => 'Fixtures\Bundles\XmlBundle'], - SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION, - true, ]); } @@ -567,8 +564,6 @@ public function testMultipleEntityManagersMappingBundleDefinitions(): void $xmlDef = $container->getDefinition('doctrine.orm.em2_xml_metadata_driver'); $this->assertDICConstructorArguments($xmlDef, [ [__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'Bundles' . DIRECTORY_SEPARATOR . 'XmlBundle' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'doctrine' => 'Fixtures\Bundles\XmlBundle'], - SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION, - true, ]); } diff --git a/UPGRADE-2.9.md b/UPGRADE-2.9.md index daff7dce2..c993016e6 100644 --- a/UPGRADE-2.9.md +++ b/UPGRADE-2.9.md @@ -30,10 +30,6 @@ doctrine: schema_manager_factory: doctrine.dbal.default_schema_manager_factory ``` -### XSD Schema validation - -Starting with `doctrine/orm` 2.14.2 the XML mapping driver will have XSD validation enabled. - ### Deprecations - the DBAL `platform_service` connection option is deprecated now. Use a driver middleware that would instantiate the platform instead.