diff options
Diffstat (limited to 'vendor/doctrine/orm/src/EntityManagerInterface.php')
-rw-r--r-- | vendor/doctrine/orm/src/EntityManagerInterface.php | 242 |
1 files changed, 242 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/EntityManagerInterface.php b/vendor/doctrine/orm/src/EntityManagerInterface.php new file mode 100644 index 0000000..cf3102b --- /dev/null +++ b/vendor/doctrine/orm/src/EntityManagerInterface.php | |||
@@ -0,0 +1,242 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM; | ||
6 | |||
7 | use DateTimeInterface; | ||
8 | use Doctrine\Common\EventManager; | ||
9 | use Doctrine\DBAL\Connection; | ||
10 | use Doctrine\DBAL\LockMode; | ||
11 | use Doctrine\ORM\Exception\ORMException; | ||
12 | use Doctrine\ORM\Internal\Hydration\AbstractHydrator; | ||
13 | use Doctrine\ORM\Mapping\ClassMetadataFactory; | ||
14 | use Doctrine\ORM\Proxy\ProxyFactory; | ||
15 | use Doctrine\ORM\Query\Expr; | ||
16 | use Doctrine\ORM\Query\FilterCollection; | ||
17 | use Doctrine\ORM\Query\ResultSetMapping; | ||
18 | use Doctrine\Persistence\ObjectManager; | ||
19 | |||
20 | interface EntityManagerInterface extends ObjectManager | ||
21 | { | ||
22 | /** | ||
23 | * {@inheritDoc} | ||
24 | * | ||
25 | * @psalm-param class-string<T> $className | ||
26 | * | ||
27 | * @psalm-return EntityRepository<T> | ||
28 | * | ||
29 | * @template T of object | ||
30 | */ | ||
31 | public function getRepository(string $className): EntityRepository; | ||
32 | |||
33 | /** | ||
34 | * Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled. | ||
35 | */ | ||
36 | public function getCache(): Cache|null; | ||
37 | |||
38 | /** | ||
39 | * Gets the database connection object used by the EntityManager. | ||
40 | */ | ||
41 | public function getConnection(): Connection; | ||
42 | |||
43 | public function getMetadataFactory(): ClassMetadataFactory; | ||
44 | |||
45 | /** | ||
46 | * Gets an ExpressionBuilder used for object-oriented construction of query expressions. | ||
47 | * | ||
48 | * Example: | ||
49 | * | ||
50 | * <code> | ||
51 | * $qb = $em->createQueryBuilder(); | ||
52 | * $expr = $em->getExpressionBuilder(); | ||
53 | * $qb->select('u')->from('User', 'u') | ||
54 | * ->where($expr->orX($expr->eq('u.id', 1), $expr->eq('u.id', 2))); | ||
55 | * </code> | ||
56 | */ | ||
57 | public function getExpressionBuilder(): Expr; | ||
58 | |||
59 | /** | ||
60 | * Starts a transaction on the underlying database connection. | ||
61 | */ | ||
62 | public function beginTransaction(): void; | ||
63 | |||
64 | /** | ||
65 | * Executes a function in a transaction. | ||
66 | * | ||
67 | * The function gets passed this EntityManager instance as an (optional) parameter. | ||
68 | * | ||
69 | * {@link flush} is invoked prior to transaction commit. | ||
70 | * | ||
71 | * If an exception occurs during execution of the function or flushing or transaction commit, | ||
72 | * the transaction is rolled back, the EntityManager closed and the exception re-thrown. | ||
73 | * | ||
74 | * @psalm-param callable(self): T $func The function to execute transactionally. | ||
75 | * | ||
76 | * @return mixed The value returned from the closure. | ||
77 | * @psalm-return T | ||
78 | * | ||
79 | * @template T | ||
80 | */ | ||
81 | public function wrapInTransaction(callable $func): mixed; | ||
82 | |||
83 | /** | ||
84 | * Commits a transaction on the underlying database connection. | ||
85 | */ | ||
86 | public function commit(): void; | ||
87 | |||
88 | /** | ||
89 | * Performs a rollback on the underlying database connection. | ||
90 | */ | ||
91 | public function rollback(): void; | ||
92 | |||
93 | /** | ||
94 | * Creates a new Query object. | ||
95 | * | ||
96 | * @param string $dql The DQL string. | ||
97 | */ | ||
98 | public function createQuery(string $dql = ''): Query; | ||
99 | |||
100 | /** | ||
101 | * Creates a native SQL query. | ||
102 | */ | ||
103 | public function createNativeQuery(string $sql, ResultSetMapping $rsm): NativeQuery; | ||
104 | |||
105 | /** | ||
106 | * Create a QueryBuilder instance | ||
107 | */ | ||
108 | public function createQueryBuilder(): QueryBuilder; | ||
109 | |||
110 | /** | ||
111 | * Finds an Entity by its identifier. | ||
112 | * | ||
113 | * @param string $className The class name of the entity to find. | ||
114 | * @param mixed $id The identity of the entity to find. | ||
115 | * @param LockMode|int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants | ||
116 | * or NULL if no specific lock mode should be used | ||
117 | * during the search. | ||
118 | * @param int|null $lockVersion The version of the entity to find when using | ||
119 | * optimistic locking. | ||
120 | * @psalm-param class-string<T> $className | ||
121 | * @psalm-param LockMode::*|null $lockMode | ||
122 | * | ||
123 | * @return object|null The entity instance or NULL if the entity can not be found. | ||
124 | * @psalm-return T|null | ||
125 | * | ||
126 | * @throws OptimisticLockException | ||
127 | * @throws ORMInvalidArgumentException | ||
128 | * @throws TransactionRequiredException | ||
129 | * @throws ORMException | ||
130 | * | ||
131 | * @template T of object | ||
132 | */ | ||
133 | public function find(string $className, mixed $id, LockMode|int|null $lockMode = null, int|null $lockVersion = null): object|null; | ||
134 | |||
135 | /** | ||
136 | * Refreshes the persistent state of an object from the database, | ||
137 | * overriding any local changes that have not yet been persisted. | ||
138 | * | ||
139 | * @param LockMode|int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants | ||
140 | * or NULL if no specific lock mode should be used | ||
141 | * during the search. | ||
142 | * @psalm-param LockMode::*|null $lockMode | ||
143 | * | ||
144 | * @throws ORMInvalidArgumentException | ||
145 | * @throws ORMException | ||
146 | * @throws TransactionRequiredException | ||
147 | */ | ||
148 | public function refresh(object $object, LockMode|int|null $lockMode = null): void; | ||
149 | |||
150 | /** | ||
151 | * Gets a reference to the entity identified by the given type and identifier | ||
152 | * without actually loading it, if the entity is not yet loaded. | ||
153 | * | ||
154 | * @param string $entityName The name of the entity type. | ||
155 | * @param mixed $id The entity identifier. | ||
156 | * @psalm-param class-string<T> $entityName | ||
157 | * | ||
158 | * @psalm-return T|null | ||
159 | * | ||
160 | * @throws ORMException | ||
161 | * | ||
162 | * @template T of object | ||
163 | */ | ||
164 | public function getReference(string $entityName, mixed $id): object|null; | ||
165 | |||
166 | /** | ||
167 | * Closes the EntityManager. All entities that are currently managed | ||
168 | * by this EntityManager become detached. The EntityManager may no longer | ||
169 | * be used after it is closed. | ||
170 | */ | ||
171 | public function close(): void; | ||
172 | |||
173 | /** | ||
174 | * Acquire a lock on the given entity. | ||
175 | * | ||
176 | * @psalm-param LockMode::* $lockMode | ||
177 | * | ||
178 | * @throws OptimisticLockException | ||
179 | * @throws PessimisticLockException | ||
180 | */ | ||
181 | public function lock(object $entity, LockMode|int $lockMode, DateTimeInterface|int|null $lockVersion = null): void; | ||
182 | |||
183 | /** | ||
184 | * Gets the EventManager used by the EntityManager. | ||
185 | */ | ||
186 | public function getEventManager(): EventManager; | ||
187 | |||
188 | /** | ||
189 | * Gets the Configuration used by the EntityManager. | ||
190 | */ | ||
191 | public function getConfiguration(): Configuration; | ||
192 | |||
193 | /** | ||
194 | * Check if the Entity manager is open or closed. | ||
195 | */ | ||
196 | public function isOpen(): bool; | ||
197 | |||
198 | /** | ||
199 | * Gets the UnitOfWork used by the EntityManager to coordinate operations. | ||
200 | */ | ||
201 | public function getUnitOfWork(): UnitOfWork; | ||
202 | |||
203 | /** | ||
204 | * Create a new instance for the given hydration mode. | ||
205 | * | ||
206 | * @psalm-param string|AbstractQuery::HYDRATE_* $hydrationMode | ||
207 | * | ||
208 | * @throws ORMException | ||
209 | */ | ||
210 | public function newHydrator(string|int $hydrationMode): AbstractHydrator; | ||
211 | |||
212 | /** | ||
213 | * Gets the proxy factory used by the EntityManager to create entity proxies. | ||
214 | */ | ||
215 | public function getProxyFactory(): ProxyFactory; | ||
216 | |||
217 | /** | ||
218 | * Gets the enabled filters. | ||
219 | */ | ||
220 | public function getFilters(): FilterCollection; | ||
221 | |||
222 | /** | ||
223 | * Checks whether the state of the filter collection is clean. | ||
224 | */ | ||
225 | public function isFiltersStateClean(): bool; | ||
226 | |||
227 | /** | ||
228 | * Checks whether the Entity Manager has filters. | ||
229 | */ | ||
230 | public function hasFilters(): bool; | ||
231 | |||
232 | /** | ||
233 | * {@inheritDoc} | ||
234 | * | ||
235 | * @psalm-param string|class-string<T> $className | ||
236 | * | ||
237 | * @psalm-return ($className is class-string<T> ? Mapping\ClassMetadata<T> : Mapping\ClassMetadata<object>) | ||
238 | * | ||
239 | * @psalm-template T of object | ||
240 | */ | ||
241 | public function getClassMetadata(string $className): Mapping\ClassMetadata; | ||
242 | } | ||