Completed
Push — refonte ( 64e01a...7173e3 )
by Arnaud
03:31
created

FakeEntityManager::detach()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace LAG\AdminBundle\Tests\Utils;
4
5
use Doctrine\ORM\Configuration;
6
use Doctrine\ORM\EntityManagerInterface;
7
use Doctrine\ORM\NativeQuery;
8
use Doctrine\ORM\OptimisticLockException;
9
use Doctrine\ORM\ORMException;
10
use Doctrine\ORM\PessimisticLockException;
11
use Doctrine\ORM\Query;
12
use Doctrine\ORM\Query\ResultSetMapping;
13
use Doctrine\ORM\QueryBuilder;
14
use Doctrine\ORM\UnitOfWork;
15
16
/**
17
 *
18
 */
19
class FakeEntityManager implements EntityManagerInterface
20
{
21
22
    /**
23
     * Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
24
     *
25
     * @return \Doctrine\ORM\Cache|null
26
     */
27
    public function getCache()
28
    {
29
        // TODO: Implement getCache() method.
30
    }
31
32
    /**
33
     * Gets the database connection object used by the EntityManager.
34
     *
35
     * @return \Doctrine\DBAL\Connection
36
     */
37
    public function getConnection()
38
    {
39
        // TODO: Implement getConnection() method.
40
    }
41
42
    /**
43
     * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
44
     *
45
     * Example:
46
     *
47
     * <code>
48
     *     $qb = $em->createQueryBuilder();
49
     *     $expr = $em->getExpressionBuilder();
50
     *     $qb->select('u')->from('User', 'u')
51
     *         ->where($expr->orX($expr->eq('u.id', 1), $expr->eq('u.id', 2)));
52
     * </code>
53
     *
54
     * @return \Doctrine\ORM\Query\Expr
55
     */
56
    public function getExpressionBuilder()
57
    {
58
        // TODO: Implement getExpressionBuilder() method.
59
    }
60
61
    /**
62
     * Starts a transaction on the underlying database connection.
63
     *
64
     * @return void
65
     */
66
    public function beginTransaction()
67
    {
68
        // TODO: Implement beginTransaction() method.
69
    }
70
71
    /**
72
     * Executes a function in a transaction.
73
     *
74
     * The function gets passed this EntityManager instance as an (optional) parameter.
75
     *
76
     * {@link flush} is invoked prior to transaction commit.
77
     *
78
     * If an exception occurs during execution of the function or flushing or transaction commit,
79
     * the transaction is rolled back, the EntityManager closed and the exception re-thrown.
80
     *
81
     * @param callable $func The function to execute transactionally.
82
     *
83
     * @return mixed The non-empty value returned from the closure or true instead.
84
     */
85
    public function transactional($func)
86
    {
87
        // TODO: Implement transactional() method.
88
    }
89
90
    /**
91
     * Commits a transaction on the underlying database connection.
92
     *
93
     * @return void
94
     */
95
    public function commit()
96
    {
97
        // TODO: Implement commit() method.
98
    }
99
100
    /**
101
     * Performs a rollback on the underlying database connection.
102
     *
103
     * @return void
104
     */
105
    public function rollback()
106
    {
107
        // TODO: Implement rollback() method.
108
    }
109
110
    /**
111
     * Creates a new Query object.
112
     *
113
     * @param string $dql The DQL string.
114
     *
115
     * @return Query
116
     */
117
    public function createQuery($dql = '')
118
    {
119
        // TODO: Implement createQuery() method.
120
    }
121
122
    /**
123
     * Creates a Query from a named query.
124
     *
125
     * @param string $name
126
     *
127
     * @return Query
128
     */
129
    public function createNamedQuery($name)
130
    {
131
        // TODO: Implement createNamedQuery() method.
132
    }
133
134
    /**
135
     * Creates a native SQL query.
136
     *
137
     * @param string $sql
138
     * @param ResultSetMapping $rsm The ResultSetMapping to use.
139
     *
140
     * @return NativeQuery
141
     */
142
    public function createNativeQuery($sql, ResultSetMapping $rsm)
143
    {
144
        // TODO: Implement createNativeQuery() method.
145
    }
146
147
    /**
148
     * Creates a NativeQuery from a named native query.
149
     *
150
     * @param string $name
151
     *
152
     * @return NativeQuery
153
     */
154
    public function createNamedNativeQuery($name)
155
    {
156
        // TODO: Implement createNamedNativeQuery() method.
157
    }
158
159
    /**
160
     * Create a QueryBuilder instance
161
     *
162
     * @return QueryBuilder
163
     */
164
    public function createQueryBuilder()
165
    {
166
        // TODO: Implement createQueryBuilder() method.
167
    }
168
169
    /**
170
     * Gets a reference to the entity identified by the given type and identifier
171
     * without actually loading it, if the entity is not yet loaded.
172
     *
173
     * @param string $entityName The name of the entity type.
174
     * @param mixed $id The entity identifier.
175
     *
176
     * @return object The entity reference.
177
     *
178
     * @throws ORMException
179
     */
180
    public function getReference($entityName, $id)
181
    {
182
        // TODO: Implement getReference() method.
183
    }
184
185
    /**
186
     * Gets a partial reference to the entity identified by the given type and identifier
187
     * without actually loading it, if the entity is not yet loaded.
188
     *
189
     * The returned reference may be a partial object if the entity is not yet loaded/managed.
190
     * If it is a partial object it will not initialize the rest of the entity state on access.
191
     * Thus you can only ever safely access the identifier of an entity obtained through
192
     * this method.
193
     *
194
     * The use-cases for partial references involve maintaining bidirectional associations
195
     * without loading one side of the association or to update an entity without loading it.
196
     * Note, however, that in the latter case the original (persistent) entity data will
197
     * never be visible to the application (especially not event listeners) as it will
198
     * never be loaded in the first place.
199
     *
200
     * @param string $entityName The name of the entity type.
201
     * @param mixed $identifier The entity identifier.
202
     *
203
     * @return object The (partial) entity reference.
204
     */
205
    public function getPartialReference($entityName, $identifier)
206
    {
207
        // TODO: Implement getPartialReference() method.
208
    }
209
210
    /**
211
     * Closes the EntityManager. All entities that are currently managed
212
     * by this EntityManager become detached. The EntityManager may no longer
213
     * be used after it is closed.
214
     *
215
     * @return void
216
     */
217
    public function close()
218
    {
219
        // TODO: Implement close() method.
220
    }
221
222
    /**
223
     * Creates a copy of the given entity. Can create a shallow or a deep copy.
224
     *
225
     * @param object $entity The entity to copy.
226
     * @param boolean $deep FALSE for a shallow copy, TRUE for a deep copy.
227
     *
228
     * @return object The new entity.
229
     *
230
     * @throws \BadMethodCallException
231
     */
232
    public function copy($entity, $deep = false)
233
    {
234
        // TODO: Implement copy() method.
235
    }
236
237
    /**
238
     * Acquire a lock on the given entity.
239
     *
240
     * @param object $entity
241
     * @param int $lockMode
242
     * @param int|null $lockVersion
243
     *
244
     * @return void
245
     *
246
     * @throws OptimisticLockException
247
     * @throws PessimisticLockException
248
     */
249
    public function lock($entity, $lockMode, $lockVersion = null)
250
    {
251
        // TODO: Implement lock() method.
252
    }
253
254
    /**
255
     * Gets the EventManager used by the EntityManager.
256
     *
257
     * @return \Doctrine\Common\EventManager
258
     */
259
    public function getEventManager()
260
    {
261
        // TODO: Implement getEventManager() method.
262
    }
263
264
    /**
265
     * Gets the Configuration used by the EntityManager.
266
     *
267
     * @return Configuration
268
     */
269
    public function getConfiguration()
270
    {
271
        // TODO: Implement getConfiguration() method.
272
    }
273
274
    /**
275
     * Check if the Entity manager is open or closed.
276
     *
277
     * @return bool
278
     */
279
    public function isOpen()
280
    {
281
        // TODO: Implement isOpen() method.
282
    }
283
284
    /**
285
     * Gets the UnitOfWork used by the EntityManager to coordinate operations.
286
     *
287
     * @return UnitOfWork
288
     */
289
    public function getUnitOfWork()
290
    {
291
        // TODO: Implement getUnitOfWork() method.
292
    }
293
294
    /**
295
     * Gets a hydrator for the given hydration mode.
296
     *
297
     * This method caches the hydrator instances which is used for all queries that don't
298
     * selectively iterate over the result.
299
     *
300
     * @deprecated
301
     *
302
     * @param int $hydrationMode
303
     *
304
     * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
305
     */
306
    public function getHydrator($hydrationMode)
307
    {
308
        // TODO: Implement getHydrator() method.
309
    }
310
311
    /**
312
     * Create a new instance for the given hydration mode.
313
     *
314
     * @param int $hydrationMode
315
     *
316
     * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
317
     *
318
     * @throws ORMException
319
     */
320
    public function newHydrator($hydrationMode)
321
    {
322
        // TODO: Implement newHydrator() method.
323
    }
324
325
    /**
326
     * Gets the proxy factory used by the EntityManager to create entity proxies.
327
     *
328
     * @return \Doctrine\ORM\Proxy\ProxyFactory
329
     */
330
    public function getProxyFactory()
331
    {
332
        // TODO: Implement getProxyFactory() method.
333
    }
334
335
    /**
336
     * Gets the enabled filters.
337
     *
338
     * @return \Doctrine\ORM\Query\FilterCollection The active filter collection.
339
     */
340
    public function getFilters()
341
    {
342
        // TODO: Implement getFilters() method.
343
    }
344
345
    /**
346
     * Checks whether the state of the filter collection is clean.
347
     *
348
     * @return boolean True, if the filter collection is clean.
349
     */
350
    public function isFiltersStateClean()
351
    {
352
        // TODO: Implement isFiltersStateClean() method.
353
    }
354
355
    /**
356
     * Checks whether the Entity Manager has filters.
357
     *
358
     * @return boolean True, if the EM has a filter collection.
359
     */
360
    public function hasFilters()
361
    {
362
        // TODO: Implement hasFilters() method.
363
    }
364
365
    /**
366
     * Finds an object by its identifier.
367
     *
368
     * This is just a convenient shortcut for getRepository($className)->find($id).
369
     *
370
     * @param string $className The class name of the object to find.
371
     * @param mixed $id The identity of the object to find.
372
     *
373
     * @return object The found object.
374
     */
375
    public function find($className, $id)
376
    {
377
        // TODO: Implement find() method.
378
    }
379
380
    /**
381
     * Tells the ObjectManager to make an instance managed and persistent.
382
     *
383
     * The object will be entered into the database as a result of the flush operation.
384
     *
385
     * NOTE: The persist operation always considers objects that are not yet known to
386
     * this ObjectManager as NEW. Do not pass detached objects to the persist operation.
387
     *
388
     * @param object $object The instance to make managed and persistent.
389
     *
390
     * @return void
391
     */
392
    public function persist($object)
393
    {
394
        // TODO: Implement persist() method.
395
    }
396
397
    /**
398
     * Removes an object instance.
399
     *
400
     * A removed object will be removed from the database as a result of the flush operation.
401
     *
402
     * @param object $object The object instance to remove.
403
     *
404
     * @return void
405
     */
406
    public function remove($object)
407
    {
408
        // TODO: Implement remove() method.
409
    }
410
411
    /**
412
     * Merges the state of a detached object into the persistence context
413
     * of this ObjectManager and returns the managed copy of the object.
414
     * The object passed to merge will not become associated/managed with this ObjectManager.
415
     *
416
     * @param object $object
417
     *
418
     * @return object
419
     */
420
    public function merge($object)
421
    {
422
        // TODO: Implement merge() method.
423
    }
424
425
    /**
426
     * Clears the ObjectManager. All objects that are currently managed
427
     * by this ObjectManager become detached.
428
     *
429
     * @param string|null $objectName if given, only objects of this type will get detached.
430
     *
431
     * @return void
432
     */
433
    public function clear($objectName = null)
434
    {
435
        // TODO: Implement clear() method.
436
    }
437
438
    /**
439
     * Detaches an object from the ObjectManager, causing a managed object to
440
     * become detached. Unflushed changes made to the object if any
441
     * (including removal of the object), will not be synchronized to the database.
442
     * Objects which previously referenced the detached object will continue to
443
     * reference it.
444
     *
445
     * @param object $object The object to detach.
446
     *
447
     * @return void
448
     */
449
    public function detach($object)
450
    {
451
        // TODO: Implement detach() method.
452
    }
453
454
    /**
455
     * Refreshes the persistent state of an object from the database,
456
     * overriding any local changes that have not yet been persisted.
457
     *
458
     * @param object $object The object to refresh.
459
     *
460
     * @return void
461
     */
462
    public function refresh($object)
463
    {
464
        // TODO: Implement refresh() method.
465
    }
466
467
    /**
468
     * Flushes all changes to objects that have been queued up to now to the database.
469
     * This effectively synchronizes the in-memory state of managed objects with the
470
     * database.
471
     *
472
     * @return void
473
     */
474
    public function flush()
475
    {
476
        // TODO: Implement flush() method.
477
    }
478
479
    /**
480
     * Gets the repository for a class.
481
     *
482
     * @param string $className
483
     *
484
     * @return \Doctrine\Common\Persistence\ObjectRepository
485
     */
486
    public function getRepository($className)
487
    {
488
        // TODO: Implement getRepository() method.
489
    }
490
491
    /**
492
     * Gets the metadata factory used to gather the metadata of classes.
493
     *
494
     * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
495
     */
496
    public function getMetadataFactory()
497
    {
498
        // TODO: Implement getMetadataFactory() method.
499
    }
500
501
    /**
502
     * Helper method to initialize a lazy loading proxy or persistent collection.
503
     *
504
     * This method is a no-op for other objects.
505
     *
506
     * @param object $obj
507
     *
508
     * @return void
509
     */
510
    public function initializeObject($obj)
511
    {
512
        // TODO: Implement initializeObject() method.
513
    }
514
515
    /**
516
     * Checks if the object is part of the current UnitOfWork and therefore managed.
517
     *
518
     * @param object $object
519
     *
520
     * @return bool
521
     */
522
    public function contains($object)
523
    {
524
        // TODO: Implement contains() method.
525
    }
526
527
    function __call($name, $arguments)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
528
    {
529
        // TODO: Implement @method Mapping\ClassMetadata getClassMetadata($className)
530
    }
531
532
    public function getClassMetadata($className)
533
    {
534
535
    }
536
}
537