diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml
index 929fba79e..3f7510b25 100644
--- a/Resources/config/orm.xml
+++ b/Resources/config/orm.xml
@@ -29,7 +29,7 @@
Doctrine\Common\Cache\ZendDataCache
- Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain
+ Doctrine\Persistence\Mapping\Driver\MappingDriverChain
Doctrine\ORM\Mapping\Driver\AnnotationDriver
Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver
Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver
diff --git a/Resources/doc/configuration.rst b/Resources/doc/configuration.rst
index ad21f0b07..d02490559 100644
--- a/Resources/doc/configuration.rst
+++ b/Resources/doc/configuration.rst
@@ -1069,4 +1069,4 @@ which is the first one defined or the one configured via the
Each connection is also accessible via the ``doctrine.dbal.[name]_connection``
service where ``[name]`` is the name of the connection.
-.. _DBAL documentation: http://www.doctrine-project.org/docs/dbal/2.0/en
+.. _DBAL documentation: https://www.doctrine-project.org/projects/doctrine-dbal/en/2.10/index.html
diff --git a/Resources/views/Collector/db.html.twig b/Resources/views/Collector/db.html.twig
index 9dc79f6b5..716452e0e 100644
--- a/Resources/views/Collector/db.html.twig
+++ b/Resources/views/Collector/db.html.twig
@@ -112,7 +112,7 @@
{% set profiler_markup_version = profiler_markup_version|default(1) %}
{% if 'explain' == page %}
- {{ render(controller('DoctrineBundle:Profiler:explain', {
+ {{ render(controller('Doctrine\\Bundle\\DoctrineBundle\\Controller\\ProfilerController::explainAction', {
token: token,
panel: 'db',
connectionName: request.query.get('connection'),
diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php
index 231c6f294..06ad2356a 100644
--- a/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -257,7 +257,7 @@ public function testDependencyInjectionConfigurationDefaults() : void
$this->assertEquals('11211', $container->getParameter('doctrine.orm.cache.memcache_port'));
$this->assertEquals('Memcache', $container->getParameter('doctrine.orm.cache.memcache_instance.class'));
$this->assertEquals('Doctrine\Common\Cache\XcacheCache', $container->getParameter('doctrine.orm.cache.xcache.class'));
- $this->assertEquals('Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain', $container->getParameter('doctrine.orm.metadata.driver_chain.class'));
+ $this->assertEquals('Doctrine\Persistence\Mapping\Driver\MappingDriverChain', $container->getParameter('doctrine.orm.metadata.driver_chain.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\AnnotationDriver', $container->getParameter('doctrine.orm.metadata.annotation.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class'));
@@ -350,13 +350,14 @@ public function testUseSavePointsAddMethodCallToAddSavepointsToTheConnection() :
$container = $this->getContainer();
$extension = new DoctrineExtension();
- $extension->load([[
- 'dbal' => [
- 'connections' => [
- 'default' => ['password' => 'foo', 'use_savepoints' => true],
+ $extension->load([
+ [
+ 'dbal' => [
+ 'connections' => [
+ 'default' => ['password' => 'foo', 'use_savepoints' => true],
+ ],
],
],
- ],
], $container);
$calls = $container->getDefinition('doctrine.dbal.default_connection')->getMethodCalls();
diff --git a/Tests/ServiceRepositoryTest.php b/Tests/ServiceRepositoryTest.php
index 418c8c5c6..f626294e0 100644
--- a/Tests/ServiceRepositoryTest.php
+++ b/Tests/ServiceRepositoryTest.php
@@ -50,21 +50,22 @@ public function testRepositoryServiceWiring() : void
$extension = new DoctrineExtension();
$container->registerExtension($extension);
- $extension->load([[
- 'dbal' => [
- 'driver' => 'pdo_sqlite',
- 'charset' => 'UTF8',
- ],
- 'orm' => [
- 'mappings' => [
- 'RepositoryServiceBundle' => [
- 'type' => 'annotation',
- 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity',
- 'prefix' => 'Fixtures\Bundles\RepositoryServiceBundle\Entity',
+ $extension->load([
+ [
+ 'dbal' => [
+ 'driver' => 'pdo_sqlite',
+ 'charset' => 'UTF8',
+ ],
+ 'orm' => [
+ 'mappings' => [
+ 'RepositoryServiceBundle' => [
+ 'type' => 'annotation',
+ 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity',
+ 'prefix' => 'Fixtures\Bundles\RepositoryServiceBundle\Entity',
+ ],
],
],
],
- ],
], $container);
$def = $container->register(TestCustomServiceRepoRepository::class, TestCustomServiceRepoRepository::class)
diff --git a/Tests/TestCase.php b/Tests/TestCase.php
index 456ff1513..b42f372a0 100644
--- a/Tests/TestCase.php
+++ b/Tests/TestCase.php
@@ -32,37 +32,39 @@ public function createXmlBundleTestContainer() : ContainerBuilder
$extension = new DoctrineExtension();
$container->registerExtension($extension);
- $extension->load([[
- 'dbal' => [
- 'connections' => [
- 'default' => [
- 'driver' => 'pdo_mysql',
- 'charset' => 'UTF8',
- 'platform-service' => 'my.platform',
+ $extension->load([
+ [
+ 'dbal' => [
+ 'connections' => [
+ 'default' => [
+ 'driver' => 'pdo_mysql',
+ 'charset' => 'UTF8',
+ 'platform-service' => 'my.platform',
+ ],
],
- ],
- 'default_connection' => 'default',
- 'types' => [
- 'test' => [
- 'class' => TestType::class,
+ 'default_connection' => 'default',
+ 'types' => [
+ 'test' => [
+ 'class' => TestType::class,
+ ],
],
],
- ], 'orm' => [
- 'default_entity_manager' => 'default',
- 'entity_managers' => [
- 'default' => [
- 'mappings' => [
- 'XmlBundle' => [
- 'type' => 'xml',
- 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine',
- 'prefix' => 'Fixtures\Bundles\XmlBundle\Entity',
+ 'orm' => [
+ 'default_entity_manager' => 'default',
+ 'entity_managers' => [
+ 'default' => [
+ 'mappings' => [
+ 'XmlBundle' => [
+ 'type' => 'xml',
+ 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine',
+ 'prefix' => 'Fixtures\Bundles\XmlBundle\Entity',
+ ],
],
],
],
+ 'resolve_target_entities' => ['Symfony\Component\Security\Core\User\UserInterface' => 'stdClass'],
],
- 'resolve_target_entities' => ['Symfony\Component\Security\Core\User\UserInterface' => 'stdClass'],
],
- ],
], $container);
$container->setDefinition('my.platform', new Definition('Doctrine\DBAL\Platforms\MySqlPlatform'))->setPublic(true);
diff --git a/UPGRADE-1.12.md b/UPGRADE-1.12.md
index c18099699..f50f794db 100644
--- a/UPGRADE-1.12.md
+++ b/UPGRADE-1.12.md
@@ -15,3 +15,31 @@ 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
index 82aee80a0..b666bcadf 100644
--- a/UPGRADE-2.0.md
+++ b/UPGRADE-2.0.md
@@ -61,3 +61,31 @@ Types
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);
+ }
+}
+```