bushbaby/doctrine-managerregistry-servicemanager

An implementation of Doctrine's ManagerRegistry for the ZendFramework ServiceManager

0.1.0 2016-01-22 10:12 UTC

README

An implementation Doctrine's ManagerRegistry for zend-servicemanager.

Install

composer require "bushbaby/doctrine-managerregistry-servicemanager"

Register ManagerRegistryFactory in the service manager.

[
	'factories' => [
		Doctrine\Common\Persistence\ManagerRegistry::class  => BsbDoctrineRegistry\Container\ManagerRegistryFactory::class,
	],
]

Usage

$managerName = 'orm_default';

/** @var \Doctrine\Common\Persistence\ManagerRegistry $managerRegistry */
$managerRegistry = $container->get(\Doctrine\Common\Persistence\ManagerRegistry::class);

/** @var ObjectManager $objectManager */
$objectManager = $managerRegistry->getManager($managerName);

/** @var ObjectRepository $repo */
$repo = $objectManager->getRepository(SomeEntity::class);