forked from doctrine/DoctrineBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistry.php
49 lines (43 loc) · 1.45 KB
/
Registry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Doctrine\Bundle\DoctrineBundle;
use Doctrine\ORM\ORMException;
use Psr\Container\ContainerInterface;
use Symfony\Bridge\Doctrine\ManagerRegistry;
/**
* References all Doctrine connections and entity managers in a given Container.
*/
class Registry extends ManagerRegistry
{
/**
* @param string[] $connections
* @param string[] $entityManagers
* @param string $defaultConnection
* @param string $defaultEntityManager
*/
public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager)
{
$this->container = $container;
parent::__construct('ORM', $connections, $entityManagers, $defaultConnection, $defaultEntityManager, 'Doctrine\ORM\Proxy\Proxy');
}
/**
* Resolves a registered namespace alias to the full namespace.
*
* This method looks for the alias in all registered entity managers.
*
* @see Configuration::getEntityNamespace
*
* @param string $alias The alias
*
* @return string The full namespace
*/
public function getAliasNamespace($alias)
{
foreach (array_keys($this->getManagers()) as $name) {
try {
return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias);
} catch (ORMException $e) {
}
}
throw ORMException::unknownEntityNamespace($alias);
}
}