Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Commite2e15f9
committed
bug#60535 [DoctrineBridge] Fix resetting the manager when using native lazy objects (HypeMC)
This PR was merged into the 7.3 branch.Discussion----------[DoctrineBridge] Fix resetting the manager when using native lazy objects| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues | -| License | MITPR#59913 doesn't seem to work as expected. For example, a simple test like this:```phpclass DoctrineTest extends KernelTestCase{ public function testManagerRegistryReset(): void { $entityManager = self::getContainer()->get(EntityManagerInterface::class); $entityManager->close(); self::assertFalse($entityManager->isOpen()); $managerRegistry = self::getContainer()->get(ManagerRegistry::class); $managerRegistry->resetManager(); self::assertTrue($entityManager->isOpen()); }}```fails with:> There was 1 error:>> 1) App\Tests\DoctrineTest::testManagerRegistryReset> Error: Call to a member function __construct() on false>> /project/var/cache/test/ContainerTVZSKa5/App_KernelTestDebugContainer.php:709> /project/vendor/symfony/doctrine-bridge/ManagerRegistry.php:91> /project/vendor/doctrine/orm/src/EntityManager.php:534> /project/tests/DoctrineTest.php:21Here's the dumped container for reference:```phpprotected static function getDoctrine_Orm_DefaultEntityManagerService($container, $lazyLoad = true){ if (true === $lazyLoad) { return $container->services['doctrine.orm.default_entity_manager'] = new \ReflectionClass('Doctrine\ORM\EntityManager')->newLazyGhost(static function ($proxy) use ($container) { self::getDoctrine_Orm_DefaultEntityManagerService($container, $proxy); }); } include_once \dirname(__DIR__, 4).'/vendor/doctrine/orm/src/Proxy/Autoloader.php'; include_once \dirname(__DIR__, 4).'/vendor/doctrine/persistence/src/Persistence/ObjectManager.php'; include_once \dirname(__DIR__, 4).'/vendor/doctrine/orm/src/EntityManagerInterface.php'; include_once \dirname(__DIR__, 4).'/vendor/doctrine/orm/src/EntityManager.php'; $instance = ($lazyLoad->__construct(($container->services['doctrine.dbal.default_connection'] ?? self::getDoctrine_Dbal_DefaultConnectionService($container)), ($container->privates['doctrine.orm.default_configuration'] ?? self::getDoctrine_Orm_DefaultConfigurationService($container)), ($container->privates['doctrine.dbal.default_connection.event_manager'] ?? self::getDoctrine_Dbal_DefaultConnection_EventManagerService($container))) && false ?: $lazyLoad); ($container->privates['doctrine.orm.default_manager_configurator'] ??= new \Doctrine\Bundle\DoctrineBundle\ManagerConfigurator([], []))->configure($instance); return $instance;}```cc `@nicolas`-grekasCommits-------5972d98 [DoctrineBridge] Fix resetting the manager when using native lazy objectsFile tree
3 files changed
+99
-18
lines changed- src/Symfony/Bridge/Doctrine
- Tests
- Fixtures
3 files changed
+99
-18
lines changedLines changed: 28 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
87 | 105 |
| |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
98 | 112 |
| |
99 | 113 |
| |
100 | 114 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
3 | 12 |
| |
4 | 13 |
| |
5 | 14 |
| |
| |||
11 | 20 |
| |
12 | 21 |
| |
13 | 22 |
| |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
14 | 27 |
| |
15 | 28 |
| |
16 | 29 |
| |
|
Lines changed: 58 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
| 25 | + | |
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
36 | 35 |
| |
37 |
| - | |
38 |
| - | |
39 | 36 |
| |
40 | 37 |
| |
41 | 38 |
| |
| |||
52 | 49 |
| |
53 | 50 |
| |
54 | 51 |
| |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
55 | 109 |
| |
56 | 110 |
| |
57 | 111 |
| |
|
0 commit comments
Comments
(0)