Symfony 5 service crash at compilation because of ManagerRegistry injection

57 Views Asked by At

Context : Migration to Symfony 5.1

I have a service that autowires a Doctrine\Persistence\ManagerRegistry

    public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $logger, Security $security, UserService $userService)
{
    $this->em = $managerRegistry->getManager('metier');
    // this line below crashes
    $this->indicateursMemorisesRepository = $this->em->getRepository(IndicateursMemorises::class);
    $this->security = $security;
    $this->userService = $userService;
    $this->logger = $logger;
}

when it reaches the commented line, it crashes to a segmentation fault.

<*****:/opt/ibexa>$ php bin/console debug:container --parameter=doctrine.entity_managers --format=json
{
    "doctrine.entity_managers": {
        "ibexa_default": "doctrine.orm.ibexa_default_entity_manager",
        "metier": "doctrine.orm.metier_entity_manager",
        "default": "doctrine.orm.default_entity_manager"
    }
}

The metier manager connects to a different database

0

There are 0 best solutions below