fce854b62c9a6f697fe4bf4449b70378ec3a3c3a
[yaffs-website] / vendor / doctrine / common / lib / Doctrine / Common / Persistence / ManagerRegistry.php
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 MIT license. 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  * @link   www.doctrine-project.org
26  * @since  2.2
27  * @author Fabien Potencier <fabien@symfony.com>
28  * @author Benjamin Eberlei <kontakt@beberlei.de>
29  * @author Lukas Kahwe Smith <smith@pooteeweet.org>
30  */
31 interface ManagerRegistry extends ConnectionRegistry
32 {
33     /**
34      * Gets the default object manager name.
35      *
36      * @return string The default object manager name.
37      */
38     public function getDefaultManagerName();
39
40     /**
41      * Gets a named object manager.
42      *
43      * @param string $name The object manager name (null for the default one).
44      *
45      * @return \Doctrine\Common\Persistence\ObjectManager
46      */
47     public function getManager($name = null);
48
49     /**
50      * Gets an array of all registered object managers.
51      *
52      * @return \Doctrine\Common\Persistence\ObjectManager[] An array of ObjectManager instances
53      */
54     public function getManagers();
55
56     /**
57      * Resets a named object manager.
58      *
59      * This method is useful when an object manager has been closed
60      * because of a rollbacked transaction AND when you think that
61      * it makes sense to get a new one to replace the closed one.
62      *
63      * Be warned that you will get a brand new object manager as
64      * the existing one is not useable anymore. This means that any
65      * other object with a dependency on this object manager will
66      * hold an obsolete reference. You can inject the registry instead
67      * to avoid this problem.
68      *
69      * @param string|null $name The object manager name (null for the default one).
70      *
71      * @return \Doctrine\Common\Persistence\ObjectManager
72      */
73     public function resetManager($name = null);
74
75     /**
76      * Resolves a registered namespace alias to the full namespace.
77      *
78      * This method looks for the alias in all registered object managers.
79      *
80      * @param string $alias The alias.
81      *
82      * @return string The full namespace.
83      */
84     public function getAliasNamespace($alias);
85
86     /**
87      * Gets all connection names.
88      *
89      * @return array An array of connection names.
90      */
91     public function getManagerNames();
92
93     /**
94      * Gets the ObjectRepository for an persistent object.
95      *
96      * @param string $persistentObject      The name of the persistent object.
97      * @param string $persistentManagerName The object manager name (null for the default one).
98      *
99      * @return \Doctrine\Common\Persistence\ObjectRepository
100      */
101     public function getRepository($persistentObject, $persistentManagerName = null);
102
103     /**
104      * Gets the object manager associated with a given class.
105      *
106      * @param string $class A persistent object class name.
107      *
108      * @return \Doctrine\Common\Persistence\ObjectManager|null
109      */
110     public function getManagerForClass($class);
111 }