diff options
Diffstat (limited to 'vendor/doctrine/persistence/src/Persistence/ManagerRegistry.php')
-rw-r--r-- | vendor/doctrine/persistence/src/Persistence/ManagerRegistry.php | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/vendor/doctrine/persistence/src/Persistence/ManagerRegistry.php b/vendor/doctrine/persistence/src/Persistence/ManagerRegistry.php new file mode 100644 index 0000000..46599a5 --- /dev/null +++ b/vendor/doctrine/persistence/src/Persistence/ManagerRegistry.php | |||
@@ -0,0 +1,89 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\Persistence; | ||
6 | |||
7 | /** | ||
8 | * Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement. | ||
9 | */ | ||
10 | interface ManagerRegistry extends ConnectionRegistry | ||
11 | { | ||
12 | /** | ||
13 | * Gets the default object manager name. | ||
14 | * | ||
15 | * @return string The default object manager name. | ||
16 | */ | ||
17 | public function getDefaultManagerName(); | ||
18 | |||
19 | /** | ||
20 | * Gets a named object manager. | ||
21 | * | ||
22 | * @param string|null $name The object manager name (null for the default one). | ||
23 | * | ||
24 | * @return ObjectManager | ||
25 | */ | ||
26 | public function getManager(?string $name = null); | ||
27 | |||
28 | /** | ||
29 | * Gets an array of all registered object managers. | ||
30 | * | ||
31 | * @return array<string, ObjectManager> An array of ObjectManager instances | ||
32 | */ | ||
33 | public function getManagers(); | ||
34 | |||
35 | /** | ||
36 | * Resets a named object manager. | ||
37 | * | ||
38 | * This method is useful when an object manager has been closed | ||
39 | * because of a rollbacked transaction AND when you think that | ||
40 | * it makes sense to get a new one to replace the closed one. | ||
41 | * | ||
42 | * Be warned that you will get a brand new object manager as | ||
43 | * the existing one is not useable anymore. This means that any | ||
44 | * other object with a dependency on this object manager will | ||
45 | * hold an obsolete reference. You can inject the registry instead | ||
46 | * to avoid this problem. | ||
47 | * | ||
48 | * @param string|null $name The object manager name (null for the default one). | ||
49 | * | ||
50 | * @return ObjectManager | ||
51 | */ | ||
52 | public function resetManager(?string $name = null); | ||
53 | |||
54 | /** | ||
55 | * Gets all object manager names and associated service IDs. A service ID | ||
56 | * is a string that allows to obtain an object manager, typically from a | ||
57 | * PSR-11 container. | ||
58 | * | ||
59 | * @return array<string,string> An array with object manager names as keys, | ||
60 | * and service IDs as values. | ||
61 | */ | ||
62 | public function getManagerNames(); | ||
63 | |||
64 | /** | ||
65 | * Gets the ObjectRepository for a persistent object. | ||
66 | * | ||
67 | * @param string $persistentObject The name of the persistent object. | ||
68 | * @param string|null $persistentManagerName The object manager name (null for the default one). | ||
69 | * @psalm-param class-string<T> $persistentObject | ||
70 | * | ||
71 | * @return ObjectRepository | ||
72 | * @psalm-return ObjectRepository<T> | ||
73 | * | ||
74 | * @template T of object | ||
75 | */ | ||
76 | public function getRepository( | ||
77 | string $persistentObject, | ||
78 | ?string $persistentManagerName = null | ||
79 | ); | ||
80 | |||
81 | /** | ||
82 | * Gets the object manager associated with a given class. | ||
83 | * | ||
84 | * @param class-string $class A persistent object class name. | ||
85 | * | ||
86 | * @return ObjectManager|null | ||
87 | */ | ||
88 | public function getManagerForClass(string $class); | ||
89 | } | ||