An implementation of Doctrine's ManagerRegistry (from doctrine/orm) for laminas/laminas-servicemanager.
composer require "bushbaby/doctrine-managerregistry-servicemanager"
Register ManagerRegistryFactory in your service manager.
return [
'dependencies' => [
'factories' => [
\Doctrine\Persistence\ManagerRegistry::class => BsbDoctrineRegistry\Container\ManagerRegistryFactory::class,
],
],
];
$managerName = 'orm_default';
/** @var \Doctrine\Persistence\ManagerRegistry $managerRegistry */
$managerRegistry = $container->get(\Doctrine\Persistence\ManagerRegistry::class);
/** @var ObjectManager $objectManager */
$objectManager = $managerRegistry->getManager($managerName);
/** @var ObjectRepository $repo */
$repo = $objectManager->getRepository(SomeEntity::class);