Skip to content

Commit

Permalink
Merge pull request #386 from doctrine/fix-no-odm
Browse files Browse the repository at this point in the history
fix registry service when odm is not enabled
  • Loading branch information
dbu authored Sep 1, 2023
2 parents 14fbaa5 + 8205dae commit 2a941be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/DependencyInjection/DoctrinePHPCRExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function load(array $configs, ContainerBuilder $container)
$this->loader->load('phpcr.xml');
$this->loader->load('commands.xml');

// default values in case no odm is configured. the manager registry needs these variables to be defined.
// if odm is enabled, the parameters are overwritten later in the `loadOdm` section.
$container->setParameter('doctrine_phpcr.odm.document_managers', []);
$container->setParameter('doctrine_phpcr.odm.default_document_manager', '');

$managerRegistryServiceId = 'doctrine_phpcr';
if (!empty($config['manager_registry_service_id'])) {
$managerRegistryServiceId = $config['manager_registry_service_id'];
Expand Down
10 changes: 7 additions & 3 deletions src/ManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
*/
final class ManagerRegistry extends BaseManagerRegistry implements ManagerRegistryInterface
{
/**
* @param string[] $connections
* @param string[] $entityManagers
*/
public function __construct(
ContainerInterface $container,
array $connections,
array $entityManagers,
$defaultConnectionName,
$defaultEntityManagerName,
$proxyInterfaceName
string $defaultConnectionName,
string $defaultEntityManagerName,
string $proxyInterfaceName
) {
$this->container = $container;

Expand Down

0 comments on commit 2a941be

Please sign in to comment.