Description
Symfony version(s) affected
5.4.0
Description
I've just tried updating from latest 5.3.11 to 5.4.0 and after the packages have been updated the container can not be built with complaints about my custom repositories not having a class set.
How to reproduce
I've created a reproducer here: https://github.com/gjuric/symfony_5_4_bug/
The repositories are defined like this:
<service id="Namespace\MyCustomDoctrineRepository">
<factory service="doctrine.orm.default_entity_manager" method="getRepository"/>
<argument>FQCN_of_my_entity</argument>
</service>
I've tried adding the class
attribute to the <service>
tag but it doesn't help.
Possible Solution
No response
Additional Context
When compiler is trying to build this server it sees it has a factory and tries to fetch the Class here:
$this->container->findDefinition((string) $class)
returns and instance of Symfony\Component\DependencyInjection\ChildDefinition
where parent
is set to doctrine.orm.entity_manager.abstract
and the class
property is set to null
. This null is then passed to return $this->getReflectionMethod(new Definition($class), $method);
where it is of course not possible to build a definition since $class
is null
.