diff --git a/config/orm.xml b/config/orm.xml
index 2d808992..375fce3e 100644
--- a/config/orm.xml
+++ b/config/orm.xml
@@ -188,6 +188,10 @@
+
+
+
+
diff --git a/src/DependencyInjection/DoctrineExtension.php b/src/DependencyInjection/DoctrineExtension.php
index 161626a7..30337a44 100644
--- a/src/DependencyInjection/DoctrineExtension.php
+++ b/src/DependencyInjection/DoctrineExtension.php
@@ -33,6 +33,7 @@
use InvalidArgumentException;
use LogicException;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
+use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolverVariableLoader;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
@@ -533,6 +534,12 @@ protected function ormLoad(array $config, ContainerBuilder $container)
$controllerResolverDefaults['evict_cache'] ?? null,
$controllerResolverDefaults['disabled'] ?? false,
]));
+ } else {
+ $container->getDefinition('doctrine.orm.entity_value_resolver')->setArgument(2, (new Definition(MapEntity::class)));
+ }
+
+ if (class_exists(ExpressionLanguage::class) && class_exists(EntityValueResolverVariableLoader::class)) {
+ $container->getDefinition('doctrine.orm.entity_value_resolver')->setArgument(3, new Reference('doctrine.orm.entity_value_resolver_variables_loader'));
}
}
diff --git a/tests/DependencyInjection/DoctrineExtensionTest.php b/tests/DependencyInjection/DoctrineExtensionTest.php
index b2a6e3c4..1c17e60d 100644
--- a/tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/tests/DependencyInjection/DoctrineExtensionTest.php
@@ -1451,7 +1451,7 @@ public function testControllerResolver(bool $simpleEntityManagerConfig): void
$controllerResolver = $container->getDefinition('doctrine.orm.entity_value_resolver');
- $this->assertEquals([new Reference('doctrine'), new Reference('doctrine.orm.entity_value_resolver.expression_language', $container::IGNORE_ON_INVALID_REFERENCE)], $controllerResolver->getArguments());
+ $this->assertEquals([new Reference('doctrine'), new Reference('doctrine.orm.entity_value_resolver.expression_language', $container::IGNORE_ON_INVALID_REFERENCE), new Definition(MapEntity::class)], $controllerResolver->getArguments());
$container = $this->getContainer();