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.
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>.
20 namespace Doctrine\Common\Persistence;
23 * Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement.
25 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
26 * @link www.doctrine-project.org
28 * @author Fabien Potencier <fabien@symfony.com>
29 * @author Benjamin Eberlei <kontakt@beberlei.de>
30 * @author Lukas Kahwe Smith <smith@pooteeweet.org>
32 interface ManagerRegistry extends ConnectionRegistry
35 * Gets the default object manager name.
37 * @return string The default object manager name
39 function getDefaultManagerName();
42 * Gets a named object manager.
44 * @param string $name The object manager name (null for the default one)
46 * @return \Doctrine\Common\Persistence\ObjectManager
48 function getManager($name = null);
51 * Gets an array of all registered object managers
53 * @return \Doctrine\Common\Persistence\ObjectManager[] An array of ObjectManager instances
55 function getManagers();
58 * Resets a named object manager.
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.
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.
70 * @param string $name The object manager name (null for the default one)
72 * @return \Doctrine\Common\Persistence\ObjectManager
74 function resetManager($name = null);
77 * Resolves a registered namespace alias to the full namespace.
79 * This method looks for the alias in all registered object managers.
81 * @param string $alias The alias
83 * @return string The full namespace
85 function getAliasNamespace($alias);
88 * Gets all connection names.
90 * @return array An array of connection names
92 function getManagerNames();
95 * Gets the ObjectRepository for an persistent object.
97 * @param string $persistentObject The name of the persistent object.
98 * @param string $persistentManagerName The object manager name (null for the default one)
100 * @return \Doctrine\Common\Persistence\ObjectRepository
102 function getRepository($persistentObject, $persistentManagerName = null);
105 * Gets the object manager associated with a given class.
107 * @param string $class A persistent object class name
109 * @return \Doctrine\Common\Persistence\ObjectManager|null
111 function getManagerForClass($class);