Total Complexity | 7 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class OptimisticLockException extends ORMException |
||
12 | { |
||
13 | /** |
||
14 | * @var object|null |
||
15 | */ |
||
16 | private $entity; |
||
17 | |||
18 | /** |
||
19 | * @param string $msg |
||
20 | * @param object $entity |
||
21 | */ |
||
22 | 10 | public function __construct($msg, $entity) |
|
23 | { |
||
24 | 10 | parent::__construct($msg); |
|
25 | 10 | $this->entity = $entity; |
|
26 | 10 | } |
|
27 | |||
28 | /** |
||
29 | * Gets the entity that caused the exception. |
||
30 | * |
||
31 | * @return object|null |
||
32 | */ |
||
33 | 5 | public function getEntity() |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param object $entity |
||
40 | * |
||
41 | * @return OptimisticLockException |
||
42 | */ |
||
43 | 5 | public static function lockFailed($entity) |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param object $entity |
||
50 | * @param int $expectedLockVersion |
||
51 | * @param int $actualLockVersion |
||
52 | * |
||
53 | * @return OptimisticLockException |
||
54 | */ |
||
55 | 2 | public static function lockFailedVersionMismatch($entity, $expectedLockVersion, $actualLockVersion) |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param string $entityName |
||
65 | * |
||
66 | * @return OptimisticLockException |
||
67 | */ |
||
68 | 3 | public static function notVersioned($entityName) |
|
73 |