bushbaby/doctrine-managerregistry-servicemanager

An implementation of Doctrine's ManagerRegistry for the Laminas ServiceManager

1.0.0 2021-08-16 11:51 UTC

This package is auto-updated.

Last update: 2024-10-16 19:24:29 UTC


README

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);