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