-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRegistry.php
More file actions
45 lines (40 loc) · 1.43 KB
/
Registry.php
File metadata and controls
45 lines (40 loc) · 1.43 KB
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
<?php
namespace Redking\ParseBundle;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Redking\ParseBundle\Exception\RedkingParseException;
class Registry extends ManagerRegistry
{
public function __construct(ContainerInterface $container, $manager_name)
{
$this->container = $container;
parent::__construct('Parse', [], ['default' => $manager_name], 'default', 'default', 'Redking\ParseBundle\Proxy\Proxy');
}
/**
* Resolves a registered namespace alias to the full namespace.
*
* This method looks for the alias in all registered entity managers.
*
* @param string $alias The alias
*
* @return string The full namespace
*
* @see Configuration::getEntityNamespace
*/
public function getAliasNamespace($alias)
{
foreach (array_keys($this->getManagers()) as $name) {
$objectManager = $this->getManager($name);
if (! $objectManager instanceof ObjectManager) {
continue;
}
try {
/** @var ObjectManager $objectManager */
return $objectManager->getConfiguration()->getEntityNamespace($alias);
} catch (RedkingParseException $e) {
}
}
throw RedkingParseException::unknownObjectNamespace($alias);
}
}