1 | <?php |
||
12 | class EntityVersionLockService |
||
13 | { |
||
14 | /** |
||
15 | * @var ObjectManager |
||
16 | */ |
||
17 | private $objectManager; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $threshold; |
||
23 | |||
24 | /** |
||
25 | * @var bool |
||
26 | */ |
||
27 | private $lockEnabled; |
||
28 | |||
29 | public function __construct(ObjectManager $em, $threshold, $lockEnabled) |
||
35 | |||
36 | /** |
||
37 | * @param LockableEntityInterface $entity |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | public function isEntityBelowThreshold(LockableEntityInterface $entity) |
||
56 | |||
57 | /** |
||
58 | * @param User $user |
||
59 | * @param LockableEntityInterface $entity |
||
60 | * |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function isEntityLocked(User $user, LockableEntityInterface $entity) |
||
86 | |||
87 | /** |
||
88 | * When editing the entity, create a new entity translation lock. |
||
89 | * |
||
90 | * @param User $user |
||
91 | * @param LockableEntity $entity |
||
92 | */ |
||
93 | protected function createEntityVersionLock(User $user, LockableEntity $entity) |
||
109 | |||
110 | /** |
||
111 | * @param LockableEntityInterface $entity |
||
112 | * @param User $userToExclude |
||
|
|||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function getUsersWithEntityVersionLock(LockableEntityInterface $entity, User $userToExclude = null) |
||
131 | |||
132 | /** |
||
133 | * @param LockableEntity $entity |
||
134 | */ |
||
135 | protected function removeExpiredLocks(LockableEntity $entity) |
||
142 | |||
143 | /** |
||
144 | * When editing an entity, check if there is a lock for this entity. |
||
145 | * |
||
146 | * @param LockableEntity $entity |
||
147 | * @param User $userToExclude |
||
148 | * |
||
149 | * @return EntityVersionLock[] |
||
150 | */ |
||
151 | protected function getEntityVersionLocksByLockableEntity(LockableEntity $entity, User $userToExclude = null) |
||
158 | |||
159 | /** |
||
160 | * Get or create a LockableEntity for an entity with LockableEntityInterface |
||
161 | * |
||
162 | * @param LockableEntityInterface $entity |
||
163 | * |
||
164 | * @return LockableEntity |
||
165 | */ |
||
166 | protected function getLockableEntity(LockableEntityInterface $entity, $create = true) |
||
178 | |||
179 | /** |
||
180 | * @param ObjectManager $objectManager |
||
181 | */ |
||
182 | public function setObjectManager($objectManager) |
||
186 | |||
187 | /** |
||
188 | * @param int $threshold |
||
189 | */ |
||
190 | public function setThreshold($threshold) |
||
194 | |||
195 | /** |
||
196 | * @param bool lockEnabled |
||
197 | */ |
||
198 | public function setLockEnabled($lockEnabled) |
||
202 | } |
||
203 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.