1 | <?php |
---|
2 | /* |
---|
3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
14 | * |
---|
15 | * This software consists of voluntary contributions made by many individuals |
---|
16 | * and is licensed under the LGPL. For more information, see |
---|
17 | * <http://www.doctrine-project.org>. |
---|
18 | */ |
---|
19 | |
---|
20 | namespace Doctrine\Common\Persistence; |
---|
21 | |
---|
22 | /** |
---|
23 | * Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement. |
---|
24 | * |
---|
25 | * @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
---|
26 | * @link www.doctrine-project.org |
---|
27 | * @since 2.2 |
---|
28 | * @author Fabien Potencier <fabien@symfony.com> |
---|
29 | * @author Benjamin Eberlei <kontakt@beberlei.de> |
---|
30 | * @author Lukas Kahwe Smith <smith@pooteeweet.org> |
---|
31 | */ |
---|
32 | interface ManagerRegistry extends ConnectionRegistry |
---|
33 | { |
---|
34 | /** |
---|
35 | * Gets the default object manager name. |
---|
36 | * |
---|
37 | * @return string The default object manager name |
---|
38 | */ |
---|
39 | function getDefaultManagerName(); |
---|
40 | |
---|
41 | /** |
---|
42 | * Gets a named object manager. |
---|
43 | * |
---|
44 | * @param string $name The object manager name (null for the default one) |
---|
45 | * |
---|
46 | * @return \Doctrine\Common\Persistence\ObjectManager |
---|
47 | */ |
---|
48 | function getManager($name = null); |
---|
49 | |
---|
50 | /** |
---|
51 | * Gets an array of all registered object managers |
---|
52 | * |
---|
53 | * @return array An array of ObjectManager instances |
---|
54 | */ |
---|
55 | function getManagers(); |
---|
56 | |
---|
57 | /** |
---|
58 | * Resets a named object manager. |
---|
59 | * |
---|
60 | * This method is useful when an object manager has been closed |
---|
61 | * because of a rollbacked transaction AND when you think that |
---|
62 | * it makes sense to get a new one to replace the closed one. |
---|
63 | * |
---|
64 | * Be warned that you will get a brand new object manager as |
---|
65 | * the existing one is not useable anymore. This means that any |
---|
66 | * other object with a dependency on this object manager will |
---|
67 | * hold an obsolete reference. You can inject the registry instead |
---|
68 | * to avoid this problem. |
---|
69 | * |
---|
70 | * @param string $name The object manager name (null for the default one) |
---|
71 | * |
---|
72 | * @return \Doctrine\Common\Persistence\ObjectManager |
---|
73 | */ |
---|
74 | function resetManager($name = null); |
---|
75 | |
---|
76 | /** |
---|
77 | * Resolves a registered namespace alias to the full namespace. |
---|
78 | * |
---|
79 | * This method looks for the alias in all registered object managers. |
---|
80 | * |
---|
81 | * @param string $alias The alias |
---|
82 | * |
---|
83 | * @return string The full namespace |
---|
84 | */ |
---|
85 | function getAliasNamespace($alias); |
---|
86 | |
---|
87 | /** |
---|
88 | * Gets all connection names. |
---|
89 | * |
---|
90 | * @return array An array of connection names |
---|
91 | */ |
---|
92 | function getManagerNames(); |
---|
93 | |
---|
94 | /** |
---|
95 | * Gets the ObjectRepository for an persistent object. |
---|
96 | * |
---|
97 | * @param string $persistentObject The name of the persistent object. |
---|
98 | * @param string $persistentManagerName The object manager name (null for the default one) |
---|
99 | * |
---|
100 | * @return \Doctrine\Common\Persistence\ObjectRepository |
---|
101 | */ |
---|
102 | function getRepository($persistentObject, $persistentManagerName = null); |
---|
103 | |
---|
104 | /** |
---|
105 | * Gets the object manager associated with a given class. |
---|
106 | * |
---|
107 | * @param string $class A persistent object class name |
---|
108 | * |
---|
109 | * @return \Doctrine\Common\Persistence\ObjectManager|null |
---|
110 | */ |
---|
111 | function getManagerForClass($class); |
---|
112 | } |
---|