These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Doctrine\Performance\Mock; |
||
4 | |||
5 | use Doctrine\ORM\EntityManagerInterface; |
||
6 | use Doctrine\ORM\Proxy\ProxyFactory; |
||
7 | use Doctrine\ORM\Query; |
||
8 | use Doctrine\ORM\Query\ResultSetMapping; |
||
9 | use Doctrine\Tests\ORM\Performance\MockUnitOfWork; |
||
10 | |||
11 | /** |
||
12 | * An entity manager mock that prevents lazy-loading of proxies |
||
13 | */ |
||
14 | class NonProxyLoadingEntityManager implements EntityManagerInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var EntityManagerInterface |
||
18 | */ |
||
19 | private $realEntityManager; |
||
20 | |||
21 | public function __construct(EntityManagerInterface $realEntityManager) |
||
22 | { |
||
23 | $this->realEntityManager = $realEntityManager; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * {@inheritDoc} |
||
28 | */ |
||
29 | public function getProxyFactory() |
||
30 | { |
||
31 | $config = $this->realEntityManager->getConfiguration(); |
||
32 | |||
33 | return new ProxyFactory( |
||
34 | $this, |
||
35 | $config->getProxyDir(), |
||
36 | $config->getProxyNamespace(), |
||
37 | $config->getAutoGenerateProxyClasses() |
||
38 | ); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | public function getMetadataFactory() |
||
45 | { |
||
46 | return $this->realEntityManager->getMetadataFactory(); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | public function getClassMetadata($className) |
||
53 | { |
||
54 | return $this->realEntityManager->getClassMetadata($className); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | public function getUnitOfWork() |
||
61 | { |
||
62 | return new NonProxyLoadingUnitOfWork(); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritDoc} |
||
67 | */ |
||
68 | public function getCache() |
||
69 | { |
||
70 | return $this->realEntityManager->getCache(); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * {@inheritDoc} |
||
75 | */ |
||
76 | public function getConnection() |
||
77 | { |
||
78 | return $this->realEntityManager->getConnection(); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * {@inheritDoc} |
||
83 | */ |
||
84 | public function getExpressionBuilder() |
||
85 | { |
||
86 | return $this->realEntityManager->getExpressionBuilder(); |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * {@inheritDoc} |
||
91 | */ |
||
92 | public function beginTransaction() |
||
93 | { |
||
94 | $this->realEntityManager->beginTransaction(); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * {@inheritDoc} |
||
99 | */ |
||
100 | public function transactional($func) |
||
101 | { |
||
102 | return $this->realEntityManager->transactional($func); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * {@inheritDoc} |
||
107 | */ |
||
108 | public function commit() |
||
109 | { |
||
110 | $this->realEntityManager->commit(); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * {@inheritDoc} |
||
115 | */ |
||
116 | public function rollback() |
||
117 | { |
||
118 | $this->realEntityManager->rollback(); |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * {@inheritDoc} |
||
123 | */ |
||
124 | public function createQuery($dql = '') |
||
125 | { |
||
126 | return $this->realEntityManager->createQuery($dql); |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * {@inheritDoc} |
||
131 | */ |
||
132 | public function createNamedQuery($name) |
||
133 | { |
||
134 | return $this->realEntityManager->createNamedQuery($name); |
||
135 | } |
||
136 | |||
137 | /** |
||
138 | * {@inheritDoc} |
||
139 | */ |
||
140 | public function createNativeQuery($sql, ResultSetMapping $rsm) |
||
141 | { |
||
142 | return $this->realEntityManager->createNativeQuery($sql, $rsm); |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * {@inheritDoc} |
||
147 | */ |
||
148 | public function createNamedNativeQuery($name) |
||
149 | { |
||
150 | return $this->realEntityManager->createNamedNativeQuery($name); |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * {@inheritDoc} |
||
155 | */ |
||
156 | public function createQueryBuilder() |
||
157 | { |
||
158 | return $this->realEntityManager->createQueryBuilder(); |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * {@inheritDoc} |
||
163 | */ |
||
164 | public function getReference($entityName, $id) |
||
165 | { |
||
166 | return $this->realEntityManager->getReference($entityName, $id); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * {@inheritDoc} |
||
171 | */ |
||
172 | public function getPartialReference($entityName, $identifier) |
||
173 | { |
||
174 | return $this->realEntityManager->getPartialReference($entityName, $identifier); |
||
175 | } |
||
176 | |||
177 | /** |
||
178 | * {@inheritDoc} |
||
179 | */ |
||
180 | public function close() |
||
181 | { |
||
182 | $this->realEntityManager->close(); |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * {@inheritDoc} |
||
187 | */ |
||
188 | public function copy($entity, $deep = false) |
||
189 | { |
||
190 | return $this->realEntityManager->copy($entity, $deep); |
||
191 | } |
||
192 | |||
193 | /** |
||
194 | * {@inheritDoc} |
||
195 | */ |
||
196 | public function lock($entity, $lockMode, $lockVersion = null) |
||
197 | { |
||
198 | $this->realEntityManager->lock($entity, $lockMode, $lockVersion); |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * {@inheritDoc} |
||
203 | */ |
||
204 | public function getEventManager() |
||
205 | { |
||
206 | return $this->realEntityManager->getEventManager(); |
||
207 | } |
||
208 | |||
209 | /** |
||
210 | * {@inheritDoc} |
||
211 | */ |
||
212 | public function getConfiguration() |
||
213 | { |
||
214 | return $this->realEntityManager->getConfiguration(); |
||
215 | } |
||
216 | |||
217 | /** |
||
218 | * {@inheritDoc} |
||
219 | */ |
||
220 | public function isOpen() |
||
221 | { |
||
222 | return $this->realEntityManager->isOpen(); |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * {@inheritDoc} |
||
227 | */ |
||
228 | public function getHydrator($hydrationMode) |
||
229 | { |
||
230 | return $this->realEntityManager->getHydrator($hydrationMode); |
||
0 ignored issues
–
show
|
|||
231 | } |
||
232 | |||
233 | /** |
||
234 | * {@inheritDoc} |
||
235 | */ |
||
236 | public function newHydrator($hydrationMode) |
||
237 | { |
||
238 | return $this->realEntityManager->newHydrator($hydrationMode); |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * {@inheritDoc} |
||
243 | */ |
||
244 | public function getFilters() |
||
245 | { |
||
246 | return $this->realEntityManager->getFilters(); |
||
247 | } |
||
248 | |||
249 | /** |
||
250 | * {@inheritDoc} |
||
251 | */ |
||
252 | public function isFiltersStateClean() |
||
253 | { |
||
254 | return $this->realEntityManager->isFiltersStateClean(); |
||
255 | } |
||
256 | |||
257 | /** |
||
258 | * {@inheritDoc} |
||
259 | */ |
||
260 | public function hasFilters() |
||
261 | { |
||
262 | return $this->realEntityManager->hasFilters(); |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * {@inheritDoc} |
||
267 | */ |
||
268 | public function find($className, $id) |
||
269 | { |
||
270 | return $this->realEntityManager->find($className, $id); |
||
271 | } |
||
272 | |||
273 | /** |
||
274 | * {@inheritDoc} |
||
275 | */ |
||
276 | public function persist($object) |
||
277 | { |
||
278 | $this->realEntityManager->persist($object); |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * {@inheritDoc} |
||
283 | */ |
||
284 | public function remove($object) |
||
285 | { |
||
286 | $this->realEntityManager->remove($object); |
||
287 | } |
||
288 | |||
289 | /** |
||
290 | * {@inheritDoc} |
||
291 | */ |
||
292 | public function merge($object) |
||
293 | { |
||
294 | return $this->realEntityManager->merge($object); |
||
295 | } |
||
296 | |||
297 | /** |
||
298 | * {@inheritDoc} |
||
299 | */ |
||
300 | public function clear($objectName = null) |
||
301 | { |
||
302 | $this->realEntityManager->clear($objectName); |
||
303 | } |
||
304 | |||
305 | /** |
||
306 | * {@inheritDoc} |
||
307 | */ |
||
308 | public function detach($object) |
||
309 | { |
||
310 | $this->realEntityManager->detach($object); |
||
311 | } |
||
312 | |||
313 | /** |
||
314 | * {@inheritDoc} |
||
315 | */ |
||
316 | public function refresh($object) |
||
317 | { |
||
318 | $this->realEntityManager->refresh($object); |
||
319 | } |
||
320 | |||
321 | /** |
||
322 | * {@inheritDoc} |
||
323 | */ |
||
324 | public function flush() |
||
325 | { |
||
326 | $this->realEntityManager->flush(); |
||
327 | } |
||
328 | |||
329 | /** |
||
330 | * {@inheritDoc} |
||
331 | */ |
||
332 | public function getRepository($className) |
||
333 | { |
||
334 | return $this->realEntityManager->getRepository($className); |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * {@inheritDoc} |
||
339 | */ |
||
340 | public function initializeObject($obj) |
||
341 | { |
||
342 | $this->realEntityManager->initializeObject($obj); |
||
343 | } |
||
344 | |||
345 | /** |
||
346 | * {@inheritDoc} |
||
347 | */ |
||
348 | public function contains($object) |
||
349 | { |
||
350 | return $this->realEntityManager->contains($object); |
||
351 | } |
||
352 | } |
This method has been deprecated.