hasDefinition('doctrine.orm.container_repository_factory')) { return; } $locatorDef = $container->getDefinition('doctrine.orm.container_repository_factory'); $repoServiceIds = array_keys($container->findTaggedServiceIds(self::REPOSITORY_SERVICE_TAG)); $repoReferences = array_map(static function ($id) { return new Reference($id); }, $repoServiceIds); $ref = ServiceLocatorTagPass::register($container, array_combine($repoServiceIds, $repoReferences)); $locatorDef->replaceArgument(0, $ref); } }