Skip to content

Commit b83ce1e

Browse files
authored
Merge pull request #1987 from greg0ire/forget-lazy-πŸ‘»
Forget about lazy ghost objects
2 parents 5e71789 + 32b505b commit b83ce1e

File tree

13 files changed

+8
-60
lines changed

13 files changed

+8
-60
lines changed

β€ŽUPGRADE-3.0.mdβ€Ž

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ and does not have a replacement.
4848
Configuration
4949
-------------
5050

51-
### The `doctrine.orm.entity_managers.some_em.report_fields_where_declared` configuration option has been removed
51+
### no-op configuration options removed
5252

53-
This option is a no-op when using `doctrine/orm` 3 and has been removed.
53+
The following configuration options are no-ops when using `doctrine/orm` 3 and
54+
have been removed:
55+
56+
- `doctrine.orm.entity_managers.some_em.report_fields_where_declared`
57+
- `doctrine.orm.enable_lazy_ghost_objects`
5458

5559
### The `doctrine.dbal.default_table_options.collate` default table option is removed
5660

β€Žconfig/schema/doctrine-1.0.xsdβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
<xsd:attribute name="proxy-dir" type="xsd:string" />
150150
<xsd:attribute name="proxy-namespace" type="xsd:string" />
151151
<xsd:attribute name="auto-generate-proxy-classes" type="xsd:string" default="false" />
152-
<xsd:attribute name="enable-lazy-ghost-objects" type="xsd:boolean" />
153152
<xsd:attribute name="enable-native-lazy-objects" type="xsd:boolean" />
154153
<xsd:attributeGroup ref="entity-manager-config" />
155154
</xsd:complexType>

β€Ždocs/en/configuration.rstβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ Configuration Reference
217217
auto_generate_proxy_classes: false
218218
proxy_dir: "%kernel.cache_dir%/doctrine/orm/Proxies"
219219
proxy_namespace: Proxies
220-
# Enables the new implementation of proxies based on lazy ghosts instead of using the legacy implementation
221-
enable_lazy_ghost_objects: false
222220
# Enables the new native implementation of PHP lazy objects instead of generated proxies
223221
enable_native_lazy_objects: false
224222
identity_generation_preferences:

β€Žsrc/DependencyInjection/Configuration.phpβ€Ž

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ private function addOrmSection(ArrayNodeDefinition $node): void
418418
$excludedKeys = [
419419
'default_entity_manager' => true,
420420
'auto_generate_proxy_classes' => true,
421-
'enable_lazy_ghost_objects' => true,
422421
'enable_native_lazy_objects' => true,
423422
'proxy_dir' => true,
424423
'proxy_namespace' => true,
@@ -494,10 +493,6 @@ private function addOrmSection(ArrayNodeDefinition $node): void
494493
->then(static fn (string $v) => constant('Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_' . strtoupper($v)))
495494
->end()
496495
->end()
497-
->booleanNode('enable_lazy_ghost_objects')
498-
->defaultValue(true)
499-
->info('Enables the new implementation of proxies based on lazy ghosts instead of using the legacy implementation')
500-
->end()
501496
->booleanNode('enable_native_lazy_objects')
502497
->defaultFalse()
503498
->info('Enables the new native implementation of PHP lazy objects instead of generated proxies')

β€Žsrc/DependencyInjection/DoctrineExtension.phpβ€Ž

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,6 @@ protected function ormLoad(array $config, ContainerBuilder $container): void
514514

515515
$container->setParameter('doctrine.default_entity_manager', $config['default_entity_manager']);
516516

517-
if (! ($config['enable_lazy_ghost_objects'] ?? false)) {
518-
throw new LogicException(
519-
'Lazy ghost objects cannot be disabled for ORM 3.',
520-
);
521-
}
522-
523517
if (! class_exists(ProxyHelper::class)) {
524518
throw new LogicException(
525519
'Lazy ghost objects cannot be enabled because the "symfony/var-exporter" library'
@@ -541,7 +535,7 @@ protected function ormLoad(array $config, ContainerBuilder $container): void
541535
trigger_deprecation('doctrine/doctrine-bundle', '2.16', 'Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated.');
542536
}
543537

544-
$options = ['auto_generate_proxy_classes', 'enable_lazy_ghost_objects', 'enable_native_lazy_objects', 'proxy_dir', 'proxy_namespace'];
538+
$options = ['auto_generate_proxy_classes', 'enable_native_lazy_objects', 'proxy_dir', 'proxy_namespace'];
545539
foreach ($options as $key) {
546540
$container->setParameter('doctrine.orm.' . $key, $config[$key]);
547541
}
@@ -662,7 +656,6 @@ protected function loadOrmEntityManager(array $entityManager, ContainerBuilder $
662656
'setQuoteStrategy' => new Reference($entityManager['quote_strategy']),
663657
'setTypedFieldMapper' => new Reference($entityManager['typed_field_mapper']),
664658
'setEntityListenerResolver' => new Reference(sprintf('doctrine.orm.%s_entity_listener_resolver', $entityManager['name'])),
665-
'setLazyGhostObjectEnabled' => '%doctrine.orm.enable_lazy_ghost_objects%',
666659
'setIdentityGenerationPreferences' => $entityManager['identity_generation_preferences'],
667660
];
668661

β€Žtests/DependencyInjection/AbstractDoctrineExtensionTestCase.phpβ€Ž

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Doctrine\ORM\Mapping\LegacyReflectionFields;
1818
use Generator;
1919
use InvalidArgumentException;
20-
use LogicException;
2120
use PDO;
2221
use PHPUnit\Framework\TestCase;
2322
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
@@ -853,17 +852,6 @@ public function testAddFilter(): void
853852
$this->assertCount(2, $entityManager->getFilters()->getEnabledFilters());
854853
}
855854

856-
public function testDisablingLazyGhostOnOrm3Throws(): void
857-
{
858-
if (! interface_exists(EntityManagerInterface::class)) {
859-
self::markTestSkipped('This test requires ORM');
860-
}
861-
862-
$this->expectException(LogicException::class);
863-
$this->expectExceptionMessage('Lazy ghost objects cannot be disabled for ORM 3.');
864-
$this->loadContainer('orm_no_lazy_ghost');
865-
}
866-
867855
public function testResolveTargetEntity(): void
868856
{
869857
if (! interface_exists(EntityManagerInterface::class)) {

β€Žtests/DependencyInjection/Compiler/IdGeneratorPassTest.phpβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function testRepositoryServiceWiring(): void
8686
],
8787
'orm' => [
8888
'mappings' => $mappings,
89-
'enable_lazy_ghost_objects' => true,
9089
/** @phpstan-ignore function.alreadyNarrowedType */
9190
'enable_native_lazy_objects' => method_exists(Configuration::class, 'enableNativeLazyObjects'),
9291
],

β€Žtests/DependencyInjection/Fixtures/TestKernel.phpβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
5050
],
5151
'orm' => [
5252
'auto_generate_proxy_classes' => true,
53-
'enable_lazy_ghost_objects' => true,
5453
/** @phpstan-ignore function.alreadyNarrowedType */
5554
'enable_native_lazy_objects' => method_exists(Configuration::class, 'enableNativeLazyObjects'),
5655
'mappings' => [

β€Žtests/DependencyInjection/Fixtures/config/xml/orm_filters.xmlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<connection name="default" dbname="db" server-version="8.0.31" />
1212
</dbal>
1313

14-
<orm enable-lazy-ghost-objects="true">
14+
<orm>
1515
<filter name="soft_delete" enabled="true" >Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter</filter>
1616
<filter name="myFilter" enabled="true" class="Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter">
1717
<parameter name="myParameter">myValue</parameter>

β€Žtests/DependencyInjection/Fixtures/config/xml/orm_no_lazy_ghost.xmlβ€Ž

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
Β (0)