|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bridge\Doctrine; |
|
13 |
|
14 use Doctrine\DBAL\Connection; |
|
15 use Doctrine\ORM\Configuration; |
|
16 use Doctrine\ORM\ORMException; |
|
17 |
|
18 /** |
|
19 * References Doctrine connections and entity managers. |
|
20 * |
|
21 * @author Fabien Potencier <fabien@symfony.com> |
|
22 */ |
|
23 interface RegistryInterface |
|
24 { |
|
25 /** |
|
26 * Gets the default connection name. |
|
27 * |
|
28 * @return string The default connection name |
|
29 */ |
|
30 function getDefaultConnectionName(); |
|
31 |
|
32 /** |
|
33 * Gets the named connection. |
|
34 * |
|
35 * @param string $name The connection name (null for the default one) |
|
36 * |
|
37 * @return Connection |
|
38 */ |
|
39 function getConnection($name = null); |
|
40 |
|
41 /** |
|
42 * Gets an array of all registered connections |
|
43 * |
|
44 * @return array An array of Connection instances |
|
45 */ |
|
46 function getConnections(); |
|
47 |
|
48 /** |
|
49 * Gets all connection names. |
|
50 * |
|
51 * @return array An array of connection names |
|
52 */ |
|
53 function getConnectionNames(); |
|
54 |
|
55 /** |
|
56 * Gets the default entity manager name. |
|
57 * |
|
58 * @return string The default entity manager name |
|
59 */ |
|
60 function getDefaultEntityManagerName(); |
|
61 |
|
62 /** |
|
63 * Gets a named entity manager. |
|
64 * |
|
65 * @param string $name The entity manager name (null for the default one) |
|
66 * |
|
67 * @return EntityManager |
|
68 */ |
|
69 function getEntityManager($name = null); |
|
70 |
|
71 /** |
|
72 * Gets an array of all registered entity managers |
|
73 * |
|
74 * @return array An array of EntityManager instances |
|
75 */ |
|
76 function getEntityManagers(); |
|
77 |
|
78 /** |
|
79 * Resets a named entity manager. |
|
80 * |
|
81 * This method is useful when an entity manager has been closed |
|
82 * because of a rollbacked transaction AND when you think that |
|
83 * it makes sense to get a new one to replace the closed one. |
|
84 * |
|
85 * Be warned that you will get a brand new entity manager as |
|
86 * the existing one is not useable anymore. This means that any |
|
87 * other object with a dependency on this entity manager will |
|
88 * hold an obsolete reference. You can inject the registry instead |
|
89 * to avoid this problem. |
|
90 * |
|
91 * @param string $name The entity manager name (null for the default one) |
|
92 * |
|
93 * @return EntityManager |
|
94 */ |
|
95 function resetEntityManager($name = null); |
|
96 |
|
97 /** |
|
98 * Resolves a registered namespace alias to the full namespace. |
|
99 * |
|
100 * This method looks for the alias in all registered entity managers. |
|
101 * |
|
102 * @param string $alias The alias |
|
103 * |
|
104 * @return string The full namespace |
|
105 * |
|
106 * @see Configuration::getEntityNamespace |
|
107 */ |
|
108 function getEntityNamespace($alias); |
|
109 |
|
110 /** |
|
111 * Gets all connection names. |
|
112 * |
|
113 * @return array An array of connection names |
|
114 */ |
|
115 function getEntityManagerNames(); |
|
116 |
|
117 /** |
|
118 * Gets the EntityRepository for an entity. |
|
119 * |
|
120 * @param string $entityName The name of the entity. |
|
121 * @param string $entityManagerNAme The entity manager name (null for the default one) |
|
122 * |
|
123 * @return Doctrine\ORM\EntityRepository |
|
124 */ |
|
125 function getRepository($entityName, $entityManagerName = null); |
|
126 |
|
127 /** |
|
128 * Gets the entity manager associated with a given class. |
|
129 * |
|
130 * @param string $class A Doctrine Entity class name |
|
131 * |
|
132 * @return EntityManager|null |
|
133 */ |
|
134 function getEntityManagerForClass($class); |
|
135 } |