These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Doctrine Bundle |
||
5 | * |
||
6 | * The code was originally distributed inside the Symfony framework. |
||
7 | * |
||
8 | * (c) Fabien Potencier <[email protected]> |
||
9 | * (c) Doctrine Project, Benjamin Eberlei <[email protected]> |
||
10 | * |
||
11 | * For the full copyright and license information, please view the LICENSE |
||
12 | * file that was distributed with this source code. |
||
13 | */ |
||
14 | |||
15 | namespace Doctrine\Bundle\DoctrineBundle; |
||
16 | |||
17 | use Symfony\Component\DependencyInjection\ContainerAwareTrait; |
||
18 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
19 | use Symfony\Bridge\Doctrine\RegistryInterface; |
||
20 | use Symfony\Bridge\Doctrine\ManagerRegistry; |
||
21 | use Doctrine\ORM\ORMException; |
||
22 | use Doctrine\ORM\EntityManager; |
||
23 | |||
24 | /** |
||
25 | * References all Doctrine connections and entity managers in a given Container. |
||
26 | * |
||
27 | * @author Fabien Potencier <[email protected]> |
||
28 | */ |
||
29 | class Registry extends ManagerRegistry implements RegistryInterface |
||
30 | { |
||
31 | /** |
||
32 | * Construct. |
||
33 | * |
||
34 | * @param ContainerInterface $container |
||
35 | * @param array $connections |
||
36 | * @param array $entityManagers |
||
37 | * @param string $defaultConnection |
||
38 | * @param string $defaultEntityManager |
||
39 | */ |
||
40 | public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager) |
||
41 | { |
||
42 | $parentTraits = class_uses(parent::class); |
||
43 | if (isset($parentTraits[ContainerAwareTrait::class])) { |
||
44 | // this case should be removed when Symfony 3.4 becomes the lowest supported version |
||
45 | // and then also, the constructor should type-hint Psr\Container\ContainerInterface |
||
46 | $this->setContainer($container); |
||
0 ignored issues
–
show
|
|||
47 | } else { |
||
48 | $this->container = $container; |
||
49 | } |
||
50 | |||
51 | parent::__construct('ORM', $connections, $entityManagers, $defaultConnection, $defaultEntityManager, 'Doctrine\ORM\Proxy\Proxy'); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Gets the default entity manager name. |
||
56 | * |
||
57 | * @return string The default entity manager name |
||
58 | * |
||
59 | * @deprecated |
||
60 | */ |
||
61 | public function getDefaultEntityManagerName() |
||
62 | { |
||
63 | @trigger_error('getDefaultEntityManagerName is deprecated since Symfony 2.1. Use getDefaultManagerName instead', E_USER_DEPRECATED); |
||
64 | |||
65 | return $this->getDefaultManagerName(); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Gets a named entity manager. |
||
70 | * |
||
71 | * @param string $name The entity manager name (null for the default one) |
||
72 | * |
||
73 | * @return EntityManager |
||
74 | * |
||
75 | * @deprecated |
||
76 | */ |
||
77 | public function getEntityManager($name = null) |
||
78 | { |
||
79 | @trigger_error('getEntityManager is deprecated since Symfony 2.1. Use getManager instead', E_USER_DEPRECATED); |
||
80 | |||
81 | return $this->getManager($name); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Gets an array of all registered entity managers |
||
86 | * |
||
87 | * @return EntityManager[] an array of all EntityManager instances |
||
88 | * |
||
89 | * @deprecated |
||
90 | */ |
||
91 | public function getEntityManagers() |
||
92 | { |
||
93 | @trigger_error('getEntityManagers is deprecated since Symfony 2.1. Use getManagers instead', E_USER_DEPRECATED); |
||
94 | |||
95 | return $this->getManagers(); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Resets a named entity manager. |
||
100 | * |
||
101 | * This method is useful when an entity manager has been closed |
||
102 | * because of a rollbacked transaction AND when you think that |
||
103 | * it makes sense to get a new one to replace the closed one. |
||
104 | * |
||
105 | * Be warned that you will get a brand new entity manager as |
||
106 | * the existing one is not usable anymore. This means that any |
||
107 | * other object with a dependency on this entity manager will |
||
108 | * hold an obsolete reference. You can inject the registry instead |
||
109 | * to avoid this problem. |
||
110 | * |
||
111 | * @param string $name The entity manager name (null for the default one) |
||
112 | * |
||
113 | * @return EntityManager |
||
114 | * |
||
115 | * @deprecated |
||
116 | */ |
||
117 | public function resetEntityManager($name = null) |
||
118 | { |
||
119 | @trigger_error('resetEntityManager is deprecated since Symfony 2.1. Use resetManager instead', E_USER_DEPRECATED); |
||
120 | |||
121 | $this->resetManager($name); |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Resolves a registered namespace alias to the full namespace. |
||
126 | * |
||
127 | * This method looks for the alias in all registered entity managers. |
||
128 | * |
||
129 | * @param string $alias The alias |
||
130 | * |
||
131 | * @return string The full namespace |
||
132 | * |
||
133 | * @deprecated |
||
134 | */ |
||
135 | public function getEntityNamespace($alias) |
||
136 | { |
||
137 | @trigger_error('getEntityNamespace is deprecated since Symfony 2.1. Use getAliasNamespace instead', E_USER_DEPRECATED); |
||
138 | |||
139 | return $this->getAliasNamespace($alias); |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * Resolves a registered namespace alias to the full namespace. |
||
144 | * |
||
145 | * This method looks for the alias in all registered entity managers. |
||
146 | * |
||
147 | * @param string $alias The alias |
||
148 | * |
||
149 | * @return string The full namespace |
||
150 | * |
||
151 | * @see Configuration::getEntityNamespace |
||
152 | */ |
||
153 | public function getAliasNamespace($alias) |
||
154 | { |
||
155 | foreach (array_keys($this->getManagers()) as $name) { |
||
156 | try { |
||
157 | return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias); |
||
158 | } catch (ORMException $e) { |
||
159 | } |
||
160 | } |
||
161 | |||
162 | throw ORMException::unknownEntityNamespace($alias); |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * Gets all connection names. |
||
167 | * |
||
168 | * @return array An array of connection names |
||
169 | * |
||
170 | * @deprecated |
||
171 | */ |
||
172 | public function getEntityManagerNames() |
||
173 | { |
||
174 | @trigger_error('getEntityManagerNames is deprecated since Symfony 2.1. Use getManagerNames instead', E_USER_DEPRECATED); |
||
175 | |||
176 | return $this->getManagerNames(); |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * Gets the entity manager associated with a given class. |
||
181 | * |
||
182 | * @param string $class A Doctrine Entity class name |
||
183 | * |
||
184 | * @return EntityManager|null |
||
185 | * |
||
186 | * @deprecated |
||
187 | */ |
||
188 | public function getEntityManagerForClass($class) |
||
189 | { |
||
190 | @trigger_error('getEntityManagerForClass is deprecated since Symfony 2.1. Use getManagerForClass instead', E_USER_DEPRECATED); |
||
191 | |||
192 | return $this->getManagerForClass($class); |
||
193 | } |
||
194 | } |
||
195 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.