PHP code example of bushbaby / doctrine-managerregistry-servicemanager
1. Go to this page and download the library: Download bushbaby/doctrine-managerregistry-servicemanager library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bushbaby / doctrine-managerregistry-servicemanager example snippets
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);