diff --git a/config/schema/doctrine-1.0.xsd b/config/schema/doctrine-1.0.xsd
index 8e0a2bea..9f36708f 100644
--- a/config/schema/doctrine-1.0.xsd
+++ b/config/schema/doctrine-1.0.xsd
@@ -227,6 +227,7 @@
+
diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst
index dc60769e..bb2fdcc5 100644
--- a/docs/en/configuration.rst
+++ b/docs/en/configuration.rst
@@ -349,6 +349,7 @@ Configuration Reference
- Acme\AppBundle\Entity\Order
- Acme\AppBundle\Entity\PhoneNumber
+ fetch_mode_subselect_batch_size: 2000
# Search for the "ResolveTargetEntityListener" class for a cookbook about this
resolve_target_entities:
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index 06cf3dbd..a29010a6 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -663,6 +663,7 @@ private function getOrmEntityManagersNode(): ArrayNodeDefinition
->scalarNode('quote_strategy')->defaultValue('doctrine.orm.quote_strategy.default')->end()
->scalarNode('typed_field_mapper')->defaultValue('doctrine.orm.typed_field_mapper.default')->end()
->scalarNode('entity_listener_resolver')->defaultNull()->end()
+ ->scalarNode('fetch_mode_subselect_batch_size')->defaultNull()->end()
->scalarNode('repository_factory')->defaultValue('doctrine.orm.container_repository_factory')->end()
->arrayNode('schema_ignore_classes')
->prototype('scalar')->end()
diff --git a/src/DependencyInjection/DoctrineExtension.php b/src/DependencyInjection/DoctrineExtension.php
index 30cbfa6f..8d469428 100644
--- a/src/DependencyInjection/DoctrineExtension.php
+++ b/src/DependencyInjection/DoctrineExtension.php
@@ -720,6 +720,7 @@ protected function loadOrmEntityManager(array $entityManager, ContainerBuilder $
'setEntityListenerResolver' => new Reference(sprintf('doctrine.orm.%s_entity_listener_resolver', $entityManager['name'])),
'setLazyGhostObjectEnabled' => '%doctrine.orm.enable_lazy_ghost_objects%',
'setIdentityGenerationPreferences' => $entityManager['identity_generation_preferences'],
+ 'setFetchModeSubselectBatchSize' => $entityManager['fetch_mode_subselect_batch_size'],
];
if (! method_exists(OrmConfiguration::class, 'setLazyGhostObjectEnabled')) {
diff --git a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php
index 4c91dc2f..14626cf1 100644
--- a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php
+++ b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php
@@ -1053,6 +1053,19 @@ public function testSchemaIgnoreClasses(): void
$this->assertDICDefinitionMethodCallOnce($def1, 'setSchemaIgnoreClasses', [0 => ['Class\A', 'Class\B']]);
}
+ public function testFetchModeSubselectBatchSize(): void
+ {
+ if (! interface_exists(EntityManagerInterface::class)) {
+ self::markTestSkipped('This test requires ORM');
+ }
+
+ $container = $this->loadContainer('orm_fetch_mode_subselect_batch_size');
+
+ $def1 = $container->getDefinition('doctrine.orm.default_configuration');
+
+ $this->assertDICDefinitionMethodCallOnce($def1, 'setFetchModeSubselectBatchSize', [10000]);
+ }
+
public function testAttachEntityListeners(): void
{
if (! interface_exists(EntityManagerInterface::class)) {
diff --git a/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml b/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml
new file mode 100644
index 00000000..0cb1ed8a
--- /dev/null
+++ b/tests/DependencyInjection/Fixtures/config/xml/orm_fetch_mode_subselect_batch_size.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml b/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml
new file mode 100644
index 00000000..0c195e5f
--- /dev/null
+++ b/tests/DependencyInjection/Fixtures/config/yml/orm_fetch_mode_subselect_batch_size.yml
@@ -0,0 +1,6 @@
+doctrine:
+ dbal:
+ default_connection: default
+
+ orm:
+ fetch_mode_subselect_batch_size: 10000