bushbaby / doctrine-managerregistry-servicemanager
An implementation of Doctrine's ManagerRegistry for the Laminas ServiceManager
Installs: 5 864
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.3 | ^8.0
- doctrine/orm: ^2.8
- laminas/laminas-servicemanager: ^3.6
Requires (Dev)
- bushbaby/php-cs-fixer-config: ^2.0
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-10-16 19:24:29 UTC
README
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);