diff --git a/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php b/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php index b715e79ae..c47958fda 100644 --- a/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php +++ b/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php @@ -117,44 +117,46 @@ public static function createPhpMappingDriver(array $namespaces, array $managerP } /** - * @param string[] $namespaces List of namespaces that are handled with annotation mapping - * @param string[] $directories List of directories to look for annotated classes - * @param string[] $managerParameters List of parameters that could which object manager name - * your bundle uses. This compiler pass will automatically - * append the parameter name for the default entity manager - * to this list. - * @param string|false $enabledParameter Service container parameter that must be present to - * enable the mapping. Set to false to not do any check, - * optional. - * @param string[] $aliasMap Map of alias to namespace. + * @param string[] $namespaces List of namespaces that are handled with annotation mapping + * @param string[] $directories List of directories to look for annotated classes + * @param string[] $managerParameters List of parameters that could which object manager name + * your bundle uses. This compiler pass will automatically + * append the parameter name for the default entity manager + * to this list. + * @param string|false $enabledParameter Service container parameter that must be present to + * enable the mapping. Set to false to not do any check, + * optional. + * @param string[] $aliasMap Map of alias to namespace. + * @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared * * @return self */ - public static function createAnnotationMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) + public static function createAnnotationMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false) { $reader = new Reference('annotation_reader'); - $driver = new Definition(AnnotationDriver::class, [$reader, $directories]); + $driver = new Definition(AnnotationDriver::class, [$reader, $directories, $reportFieldsWhereDeclared]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } /** - * @param string[] $namespaces List of namespaces that are handled with annotation mapping - * @param string[] $directories List of directories to look for annotated classes - * @param string[] $managerParameters List of parameters that could which object manager name - * your bundle uses. This compiler pass will automatically - * append the parameter name for the default entity manager - * to this list. - * @param string|false $enabledParameter Service container parameter that must be present to - * enable the mapping. Set to false to not do any check, - * optional. - * @param string[] $aliasMap Map of alias to namespace. + * @param string[] $namespaces List of namespaces that are handled with annotation mapping + * @param string[] $directories List of directories to look for annotated classes + * @param string[] $managerParameters List of parameters that could which object manager name + * your bundle uses. This compiler pass will automatically + * append the parameter name for the default entity manager + * to this list. + * @param string|false $enabledParameter Service container parameter that must be present to + * enable the mapping. Set to false to not do any check, + * optional. + * @param string[] $aliasMap Map of alias to namespace. + * @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared * * @return self */ - public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) + public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false) { - $driver = new Definition(AttributeDriver::class, [$directories]); + $driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } diff --git a/Tests/DependencyInjection/Fixtures/TestKernel.php b/Tests/DependencyInjection/Fixtures/TestKernel.php index 4184257f7..3e48c4980 100644 --- a/Tests/DependencyInjection/Fixtures/TestKernel.php +++ b/Tests/DependencyInjection/Fixtures/TestKernel.php @@ -43,7 +43,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void 'secret' => 'F00', 'http_method_override' => false, 'annotations' => [ - 'enabled' => class_exists(Annotation::class), + 'enabled' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 64000, ], ]); diff --git a/UPGRADE-1.11.md b/UPGRADE-1.11.md deleted file mode 100644 index a2fc07312..000000000 --- a/UPGRADE-1.11.md +++ /dev/null @@ -1,35 +0,0 @@ -UPGRADE FROM 1.10 to 1.11 -========================= - -PHP and Symfony version support -------------------------------- - - * Support for PHP 5.5, 5.6 and 7.0 was dropped - * Support for unsupported Symfony versions was dropped. The bundle now supports - Symfony 3.4 LTS and 4.1 or newer. - * Support for Twig 1.34 and below as well as 2.4 and below (for 2.x) releases - was dropped. - -Commands --------- - - * Deprecated instantiating `Doctrine\Bundle\DoctrineBundle\Command` without a - `ManagerRegistry` instance. - * Deprecated `setContainer` and `getContainer` in - `Doctrine\Bundle\DoctrineBundle\Command`. - * `Doctrine\Bundle\DoctrineBundle\Command` no longer implements - `ContainerAwareInterface`. - -Mapping -------- - - * Renamed `ContainerAwareEntityListenerResolver` to - `ContainerEntityListenerResolver`. - -Types ------ - - * Marking types as commented in the configuration is deprecated. Instead, mark - them commented using the `requiresSQLCommentHint()` method of the type. - * The `commented` configuration option for types will be dropped in a future - release. You should avoid using it. diff --git a/UPGRADE-1.12.md b/UPGRADE-1.12.md deleted file mode 100644 index f50f794db..000000000 --- a/UPGRADE-1.12.md +++ /dev/null @@ -1,45 +0,0 @@ -UPGRADE FROM 1.11 to 1.12 -========================= - -Deprecation of DoctrineCacheBundle ----------------------------------- - -With DoctrineCacheBundle [being deprecated](https://github.com/doctrine/DoctrineCacheBundle/issues/156), -configuring caches through it has been deprecated. If you are using anything -other than the `pool` or `id` cache types, please update your configuration to -either use symfony/cache through the `pool` type or configure your cache -services manually and use the `service` type. - -Service aliases ---------------- - - * Deprecated the `Symfony\Bridge\Doctrine\RegistryInterface` and `Doctrine\Bundle\DoctrineBundle\Registry` service alias, use `Doctrine\Common\Persistence\ManagerRegistry` instead. - * Deprecated the `Doctrine\Common\Persistence\ObjectManager` service alias, use `Doctrine\ORM\EntityManagerInterface` instead. - -UnitOfWork cleared between each request ---------------------------------------- -If all of these are true: -* You call `Symfony\Bundle\FrameworkBundle\Client::disableReboot()` in your test case -* Trigger multiple HTTP requests (via `Symfony\Bundle\FrameworkBundle\Client::request()` etc.) within your test case -* Your test case relies on Doctrine ORM keeping references to old entities between requests (this is most obvious when calling `Doctrine\Persistence\ObjectManager::refresh`) - -Your test case will fail since `DoctrineBundle` 1.12.3, as identity map is now cleared between each request -to better simulate real requests and avoid memory leaks. You have two options to solve this: - -1. Change your test cases with new behaviour in mind. In a lot of cases this just means to replace `ObjectManager::refresh($entity)` with `$entity = ObjectManager::find($entity->getId())`. This is the recommended solution. -2. Write a compiler pass which restores old behaviour, e.g. by adding the following to your `Kernel` class: -```php -protected function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container) -{ - parent::build($container); - - if ($this->environment === 'test') { - $container->addCompilerPass(new class implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface { - public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) - { - $container->getDefinition('doctrine')->clearTag('kernel.reset'); - } - }, \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); - } -} -``` diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md deleted file mode 100644 index b666bcadf..000000000 --- a/UPGRADE-2.0.md +++ /dev/null @@ -1,91 +0,0 @@ -UPGRADE FROM 1.x to 2.0 -======================= - -PHP and Symfony version support -------------------------------- - - * Support for PHP 5.5, 5.6 and 7.0 was dropped - * Support for unsupported Symfony versions was dropped. The bundle now supports - Symfony 3.4 LTS and 4.1 or newer. - * Support for Twig 1.34 and below as well as 2.4 and below (for 2.x) releases - was dropped. - * When no charset parameter is defined, it now defaults to `utf8mb4` on the - MySQL platform and to `utf8` on all other platforms. - -Commands --------- - - * `Doctrine\Bundle\DoctrineBundle\Command` requires a `ManagerRegistry` - instance when instantiating. - * Dropped `setContainer` and `getContainer` in - `Doctrine\Bundle\DoctrineBundle\Command`. - * `Doctrine\Bundle\DoctrineBundle\Command` no longer implements - `ContainerAwareInterface`. - * `Doctrine\Bundle\DoctrineBundle\Command\GenerateEntitiesDoctrineCommand` was - dropped in favour of the MakerBundle. - -Deprecation of DoctrineCacheBundle ----------------------------------- - -Configuring caches through DoctrineCacheBundle is no longer possible. Please use -symfony/cache through the `pool` type or configure your cache services manually -and use the `service` type. - -Mapping -------- - - * Dropped `ContainerAwareEntityListenerResolver`, use - `ContainerEntityListenerResolver` instead. - -Registry --------- - - * `Registry` no longer implements `Symfony\Bridge\Doctrine\RegistryInterface`. - * Removed all deprecated entity manager specific methods from the registry. - -Service aliases ---------------- - - * The `Symfony\Bridge\Doctrine\RegistryInterface` interface is no longer aliased - to the `doctrine` service, use `Doctrine\Common\Persistence\ManagerRegistry` - instead. - * The `Doctrine\Common\Persistence\ObjectManager` interface is no longer - aliased to the `doctrine.orm.entity_manager` service, use - `Doctrine\ORM\EntityManagerInterface` instead. - -Types ------ - - * Marking types as commented in the configuration is no longer supported. - Instead, mark them commented using the `requiresSQLCommentHint()` method of - the type. - * The `commented` configuration option for types will be dropped in a future - release. You should not use it. - -UnitOfWork cleared between each request ---------------------------------------- -If all of these are true: -* You call `Symfony\Bundle\FrameworkBundle\Client::disableReboot()` in your test case -* Trigger multiple HTTP requests (via `Symfony\Bundle\FrameworkBundle\Client::request()` etc.) within your test case -* Your test case relies on Doctrine ORM keeping references to old entities between requests (this is most obvious when calling `Doctrine\Persistence\ObjectManager::refresh`) - -Your test case will fail since `DoctrineBundle` 2.0.3, as identity map is now cleared between each request -to better simulate real requests and avoid memory leaks. You have two options to solve this: - -1. Change your test cases with new behaviour in mind. In a lot of cases this just means to replace `ObjectManager::refresh($entity)` with `$entity = ObjectManager::find($entity->getId())`. This is the recommended solution. -2. Write a compiler pass which restores old behaviour, e.g. by adding the following to your `Kernel` class: -```php -protected function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container) -{ - parent::build($container); - - if ($this->environment === 'test') { - $container->addCompilerPass(new class implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface { - public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) - { - $container->getDefinition('doctrine')->clearTag('kernel.reset'); - } - }, \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); - } -} -``` diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md deleted file mode 100644 index d15c8ccb5..000000000 --- a/UPGRADE-2.1.md +++ /dev/null @@ -1,63 +0,0 @@ -UPGRADE FROM 2.0 to 2.1 -======================= - -Commands --------- - - * `Doctrine\Bundle\DoctrineBundle\Command\ImportMappingDoctrineCommand` has been deprecated - -Parameters ----------- - -Following parameters are deprecated and will no longer be defined nor consumed in future. -Redefine/decorate services where they are used in via DI configuration instead. - -* doctrine.class -* doctrine.data_collector.class -* doctrine.dbal.connection.event_manager.class -* doctrine.dbal.connection_factory.class -* doctrine.dbal.configuration.class -* doctrine.dbal.events.mysql_session_init.class -* doctrine.dbal.events.oracle_session_init.class -* doctrine.dbal.logger.chain.class -* doctrine.dbal.logger.class -* doctrine.dbal.logger.profiling.class -* doctrine.orm.cache.apc.class -* doctrine.orm.cache.array.class -* doctrine.orm.cache.memcache.class -* doctrine.orm.cache.memcache_instance.class -* doctrine.orm.cache.memcached.class -* doctrine.orm.cache.memcached_instance.class -* doctrine.orm.cache.redis.class -* doctrine.orm.cache.redis_instance.class -* doctrine.orm.cache.wincache.class -* doctrine.orm.cache.xcache.class -* doctrine.orm.cache.zenddata.class -* doctrine.orm.configuration.class -* doctrine.orm.entity_listener_resolver.class -* doctrine.orm.entity_manager.class -* doctrine.orm.listeners.attach_entity_listeners.class -* doctrine.orm.listeners.resolve_target_entity.class -* doctrine.orm.manager_configurator.class -* doctrine.orm.metadata.annotation.class -* doctrine.orm.metadata.driver_chain.class -* doctrine.orm.metadata.php.class -* doctrine.orm.metadata.staticphp.class -* doctrine.orm.metadata.xml.class -* doctrine.orm.metadata.yml.class -* doctrine.orm.naming_strategy.default.class -* doctrine.orm.naming_strategy.underscore.class -* doctrine.orm.proxy_cache_warmer.class -* doctrine.orm.quote_strategy.ansi.class -* doctrine.orm.quote_strategy.default.class -* doctrine.orm.second_level_cache.cache_configuration.class -* doctrine.orm.second_level_cache.default_cache_factory.class -* doctrine.orm.second_level_cache.default_region.class -* doctrine.orm.second_level_cache.filelock_region.class -* doctrine.orm.second_level_cache.logger_chain.class -* doctrine.orm.second_level_cache.logger_statistics.class -* doctrine.orm.second_level_cache.regions_configuration.class -* doctrine.orm.security.user.provider.class -* doctrine.orm.validator.unique.class -* doctrine.orm.validator_initializer.class -* form.type_guesser.doctrine.class diff --git a/UPGRADE-2.2.md b/UPGRADE-2.2.md deleted file mode 100644 index caa96166d..000000000 --- a/UPGRADE-2.2.md +++ /dev/null @@ -1,15 +0,0 @@ -UPGRADE FROM 2.1 to 2.2 -======================= - -Commands --------- - - * `doctrine:query:sql` command has been deprecated. Use `dbal:run-sql` command instead. - -Configuration --------- - * Following the [changes in DBAL 2.11](https://github.com/doctrine/dbal/pull/4054), we deprecated following configuration keys: - * `doctrine.dbal.slaves`. Use `doctrine.dbal.replicas` - * `doctrine.dbal.keep_slave`. Use `doctrine.dbal.keep_replica` - - Similarly, if you use XML configuration, please replace `` with ``. diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md deleted file mode 100644 index 950c6c402..000000000 --- a/UPGRADE-2.3.md +++ /dev/null @@ -1,17 +0,0 @@ -UPGRADE FROM 2.2 to 2.3 -======================= - -Commands --------- - - * The `\Doctrine\Bundle\DoctrineBundle\Command\Proxy\ClearMetadataCacheDoctrineCommand` (`doctrine:cache:clear-metadata`) is deprecated, metadata cache now uses PHP Array cache which can not be cleared. - -Configuration --------- - * The `metadata_cache_driver` configuration key has been deprecated. PHP Array cache is now automatically registered when `%kernel.debug%` is false. - -DependencyInjection --------- - - * `\Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter` has been deprecated. Implement your own include/exclude strategies. - * `\Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\WellKnownSchemaFilterPass` has been deprecated. Implement your own include/exclude strategies. diff --git a/UPGRADE-2.4.md b/UPGRADE-2.4.md deleted file mode 100644 index a6686db39..000000000 --- a/UPGRADE-2.4.md +++ /dev/null @@ -1,14 +0,0 @@ -UPGRADE FROM 2.3 to 2.4 -======================= - -Configuration --------- - - * Setting the `host`, `port`, `user`, `password`, `path`, `dbname`, `unix_socket` - or `memory` configuration options while the `url` one is set has been deprecated. - * The `override_url` configuration option has been deprecated. - -ConnectionFactory --------- - - * The `connection_override_options` parameter has been deprecated. diff --git a/UPGRADE-2.5.md b/UPGRADE-2.5.md deleted file mode 100644 index 01f18746d..000000000 --- a/UPGRADE-2.5.md +++ /dev/null @@ -1,7 +0,0 @@ -UPGRADE FROM 2.4 to 2.5 -======================= - -Configuration --------- - * The `metadata_cache_driver` configuration key is no longer deprecated. - diff --git a/UPGRADE-2.6.md b/UPGRADE-2.6.md deleted file mode 100644 index c05fec669..000000000 --- a/UPGRADE-2.6.md +++ /dev/null @@ -1,7 +0,0 @@ -UPGRADE FROM 2.5 to 2.6 -======================= - -Configuration -------------- - * The `collate` default table option is deprecated in favor of `collation` - diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md deleted file mode 100644 index 78476c701..000000000 --- a/UPGRADE-2.8.md +++ /dev/null @@ -1,24 +0,0 @@ -UPGRADE FROM 2.7 to 2.8 -======================= - -Dependencies -------- - * support for PHP 7.1, 7.2 and 7.3 has been dropped. - * support for `doctrine/dbal` 2 has been dropped. - -Commands --------- - * Support for using Shards has been removed from `Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand` as it's not supported using DBAL 3. - * Support for using Shards has been removed from `Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand` as it's not supported using DBAL 3. - * Support for using Shards has been removed from `Doctrine\Bundle\DoctrineBundle\Command\ImportMappingDoctrineCommand` as it's not supported using DBAL 3. - * The `Doctrine\Bundle\DoctrineBundle\Command\Proxy\ImportDoctrineCommand` command has been removed as it's not supported using DBAL 3. - * All ORM proxy commands in the namespace `Doctrine\Bundle\DoctrineBundle\Command\Proxy\` have been deprecated. Use their corresponding ORM command class directly instead. - -Configuration --------- - * The `shard_manager_class`, `shard_choser`, `shard_choser_service` and `shards` configuration keys have been removed as they are not supported using DBAL 3 - -Dependency-Injection --------- -* The `doctrine.dbal.logging`, `doctrine.dbal.logger.chain`, `doctrine.dbal.logger.profiling` and `doctrine.dbal.logger.backtrace` services have been removed -* The `doctrine.dbal.logger.chain.class`, `doctrine.dbal.logger.profiling.class` and `doctrine.dbal.logger.class` parameters have been removed diff --git a/UPGRADE-2.9.md b/UPGRADE-2.9.md deleted file mode 100644 index c993016e6..000000000 --- a/UPGRADE-2.9.md +++ /dev/null @@ -1,35 +0,0 @@ -UPGRADE FROM 2.8 to 2.9 -======================= - -Configuration --------- - -### Schema manager factory - -Due to changes and deprecations on `doctrine/dbal` 3.6+ we introduced a new option to configure a Schema manager factory. - -On DBAL 3 the default factory is an instance of `Doctrine\DBAL\Schema\LegacySchemaManagerFactory`. -For the upcoming DBAL 4 release the default will change to `Doctrine\DBAL\Schema\DefaultSchemaManagerFactory`. - -To prepare for DBAL 4 and fix DBAL related deprecations we recommend changing the configuration to use the new factory. - -Before: -```yaml -doctrine: - dbal: - connections: - default: ~ -``` - -After: -```yaml -doctrine: - dbal: - connections: - default: - schema_manager_factory: doctrine.dbal.default_schema_manager_factory -``` - -### Deprecations - -- the DBAL `platform_service` connection option is deprecated now. Use a driver middleware that would instantiate the platform instead.