Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.08 KB

File metadata and controls

40 lines (27 loc) · 1.08 KB

Laminas ServiceManager Doctrine's ManagerRegistry

Build Status

An implementation of Doctrine's ManagerRegistry (from doctrine/orm) for laminas/laminas-servicemanager.

Install
composer require "bushbaby/doctrine-managerregistry-servicemanager"

Register ManagerRegistryFactory in your service manager.

return [
    'dependencies' => [
        'factories' => [
            \Doctrine\Persistence\ManagerRegistry::class  => BsbDoctrineRegistry\Container\ManagerRegistryFactory::class,
        ],
    ],
];
Usage
$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);