diff options
Diffstat (limited to 'vendor/doctrine/persistence/src/Persistence/ObjectManager.php')
-rw-r--r-- | vendor/doctrine/persistence/src/Persistence/ObjectManager.php | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/vendor/doctrine/persistence/src/Persistence/ObjectManager.php b/vendor/doctrine/persistence/src/Persistence/ObjectManager.php new file mode 100644 index 0000000..efac5c3 --- /dev/null +++ b/vendor/doctrine/persistence/src/Persistence/ObjectManager.php | |||
@@ -0,0 +1,145 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\Persistence; | ||
6 | |||
7 | use Doctrine\Persistence\Mapping\ClassMetadata; | ||
8 | use Doctrine\Persistence\Mapping\ClassMetadataFactory; | ||
9 | |||
10 | /** | ||
11 | * Contract for a Doctrine persistence layer ObjectManager class to implement. | ||
12 | * | ||
13 | * @method bool isUninitializedObject(mixed $value) Implementing this method will be mandatory in version 4. | ||
14 | */ | ||
15 | interface ObjectManager | ||
16 | { | ||
17 | /** | ||
18 | * Finds an object by its identifier. | ||
19 | * | ||
20 | * This is just a convenient shortcut for getRepository($className)->find($id). | ||
21 | * | ||
22 | * @param string $className The class name of the object to find. | ||
23 | * @param mixed $id The identity of the object to find. | ||
24 | * @psalm-param class-string<T> $className | ||
25 | * | ||
26 | * @return object|null The found object. | ||
27 | * @psalm-return T|null | ||
28 | * | ||
29 | * @template T of object | ||
30 | */ | ||
31 | public function find(string $className, $id); | ||
32 | |||
33 | /** | ||
34 | * Tells the ObjectManager to make an instance managed and persistent. | ||
35 | * | ||
36 | * The object will be entered into the database as a result of the flush operation. | ||
37 | * | ||
38 | * NOTE: The persist operation always considers objects that are not yet known to | ||
39 | * this ObjectManager as NEW. Do not pass detached objects to the persist operation. | ||
40 | * | ||
41 | * @param object $object The instance to make managed and persistent. | ||
42 | * | ||
43 | * @return void | ||
44 | */ | ||
45 | public function persist(object $object); | ||
46 | |||
47 | /** | ||
48 | * Removes an object instance. | ||
49 | * | ||
50 | * A removed object will be removed from the database as a result of the flush operation. | ||
51 | * | ||
52 | * @param object $object The object instance to remove. | ||
53 | * | ||
54 | * @return void | ||
55 | */ | ||
56 | public function remove(object $object); | ||
57 | |||
58 | /** | ||
59 | * Clears the ObjectManager. All objects that are currently managed | ||
60 | * by this ObjectManager become detached. | ||
61 | * | ||
62 | * @return void | ||
63 | */ | ||
64 | public function clear(); | ||
65 | |||
66 | /** | ||
67 | * Detaches an object from the ObjectManager, causing a managed object to | ||
68 | * become detached. Unflushed changes made to the object if any | ||
69 | * (including removal of the object), will not be synchronized to the database. | ||
70 | * Objects which previously referenced the detached object will continue to | ||
71 | * reference it. | ||
72 | * | ||
73 | * @param object $object The object to detach. | ||
74 | * | ||
75 | * @return void | ||
76 | */ | ||
77 | public function detach(object $object); | ||
78 | |||
79 | /** | ||
80 | * Refreshes the persistent state of an object from the database, | ||
81 | * overriding any local changes that have not yet been persisted. | ||
82 | * | ||
83 | * @param object $object The object to refresh. | ||
84 | * | ||
85 | * @return void | ||
86 | */ | ||
87 | public function refresh(object $object); | ||
88 | |||
89 | /** | ||
90 | * Flushes all changes to objects that have been queued up to now to the database. | ||
91 | * This effectively synchronizes the in-memory state of managed objects with the | ||
92 | * database. | ||
93 | * | ||
94 | * @return void | ||
95 | */ | ||
96 | public function flush(); | ||
97 | |||
98 | /** | ||
99 | * Gets the repository for a class. | ||
100 | * | ||
101 | * @psalm-param class-string<T> $className | ||
102 | * | ||
103 | * @psalm-return ObjectRepository<T> | ||
104 | * | ||
105 | * @template T of object | ||
106 | */ | ||
107 | public function getRepository(string $className); | ||
108 | |||
109 | /** | ||
110 | * Returns the ClassMetadata descriptor for a class. | ||
111 | * | ||
112 | * The class name must be the fully-qualified class name without a leading backslash | ||
113 | * (as it is returned by get_class($obj)). | ||
114 | * | ||
115 | * @psalm-param class-string<T> $className | ||
116 | * | ||
117 | * @psalm-return ClassMetadata<T> | ||
118 | * | ||
119 | * @template T of object | ||
120 | */ | ||
121 | public function getClassMetadata(string $className); | ||
122 | |||
123 | /** | ||
124 | * Gets the metadata factory used to gather the metadata of classes. | ||
125 | * | ||
126 | * @psalm-return ClassMetadataFactory<ClassMetadata<object>> | ||
127 | */ | ||
128 | public function getMetadataFactory(); | ||
129 | |||
130 | /** | ||
131 | * Helper method to initialize a lazy loading proxy or persistent collection. | ||
132 | * | ||
133 | * This method is a no-op for other objects. | ||
134 | * | ||
135 | * @return void | ||
136 | */ | ||
137 | public function initializeObject(object $obj); | ||
138 | |||
139 | /** | ||
140 | * Checks if the object is part of the current UnitOfWork and therefore managed. | ||
141 | * | ||
142 | * @return bool | ||
143 | */ | ||
144 | public function contains(object $object); | ||
145 | } | ||