1 | <?php |
||
16 | class ApiPersister implements EntityPersister |
||
17 | { |
||
18 | /** @var RpcClientInterface */ |
||
19 | private $client; |
||
20 | /** @var EntityMetadata */ |
||
21 | private $metadata; |
||
22 | /** @var EntityManager */ |
||
23 | private $manager; |
||
24 | |||
25 | /** |
||
26 | * ApiPersister constructor. |
||
27 | * |
||
28 | * @param EntityManager $manager |
||
29 | * @param ApiMetadata $metadata |
||
30 | */ |
||
31 | 13 | public function __construct(EntityManager $manager, ApiMetadata $metadata) |
|
37 | |||
38 | /** |
||
39 | * @return ApiMetadata |
||
40 | */ |
||
41 | 11 | public function getClassMetadata() |
|
45 | |||
46 | /** |
||
47 | * Updates a managed entity. The entity is updated according to its current changeset |
||
48 | * in the running UnitOfWork. If there is no changeset, nothing is updated. |
||
49 | * |
||
50 | * @param object $entity The entity to update. |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function update($entity) |
||
58 | |||
59 | /** |
||
60 | * Deletes a managed entity. |
||
61 | * |
||
62 | * The entity to delete must be managed and have a persistent identifier. |
||
63 | * The deletion happens instantaneously. |
||
64 | * |
||
65 | * Subclasses may override this method to customize the semantics of entity deletion. |
||
66 | * |
||
67 | * @param object $entity The entity to delete. |
||
68 | * |
||
69 | * @return bool TRUE if the entity got deleted in the database, FALSE otherwise. |
||
70 | */ |
||
71 | public function delete($entity) |
||
75 | |||
76 | /** |
||
77 | * Count entities (optionally filtered by a criteria) |
||
78 | * |
||
79 | * @param array|\Doctrine\Common\Collections\Criteria $criteria |
||
80 | * |
||
81 | * @return int |
||
82 | */ |
||
83 | public function count($criteria = []) |
||
87 | |||
88 | /** |
||
89 | * Loads a list of entities by a list of field criteria. |
||
90 | * |
||
91 | * @param array $criteria |
||
92 | * @param array|null $orderBy |
||
93 | * @param int|null $limit |
||
94 | * @param int|null $offset |
||
95 | * |
||
96 | * @return Collection |
||
97 | */ |
||
98 | 5 | public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null) |
|
158 | |||
159 | /** |
||
160 | * Loads an entity by a list of field criteria. |
||
161 | * |
||
162 | * @param array $criteria The criteria by which to load the entity. |
||
163 | * @param object|null $entity The entity to load the data into. If not specified, a new entity is created. |
||
164 | * @param array|null $assoc The association that connects the entity to load to another entity, if any. |
||
165 | * @param int|null $limit Limit number of results. |
||
166 | * @param array|null $orderBy Criteria to order by. |
||
167 | * |
||
168 | * @return object|null The loaded and managed entity instance or NULL if the entity can not be found. |
||
169 | */ |
||
170 | public function load(array $criteria, |
||
178 | |||
179 | /** |
||
180 | * Loads an entity of this persister's mapped class as part of a single-valued |
||
181 | * association from another entity. |
||
182 | * |
||
183 | * @param array $assoc The association to load. |
||
184 | * @param object $sourceEntity The entity that owns the association (not necessarily the "owning side"). |
||
185 | * @param array $identifier The identifier of the entity to load. Must be provided if |
||
186 | * the association to load represents the owning side, otherwise |
||
187 | * the identifier is derived from the $sourceEntity. |
||
188 | * |
||
189 | * @return object The loaded and managed entity instance or NULL if the entity can not be found. |
||
190 | */ |
||
191 | public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = []) |
||
204 | |||
205 | 11 | public function loadById(array $identifiers, $entity = null) |
|
220 | |||
221 | /** |
||
222 | * Refreshes a managed entity. |
||
223 | * |
||
224 | * @param array $id The identifier of the entity as an associative array from |
||
225 | * column or field names to values. |
||
226 | * @param object $entity The entity to refresh. |
||
227 | * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants |
||
228 | * or NULL if no specific lock mode should be used |
||
229 | * for refreshing the managed entity. |
||
230 | * |
||
231 | * @return void |
||
232 | */ |
||
233 | public function refresh(array $id, $entity, $lockMode = null) |
||
237 | |||
238 | /** |
||
239 | * Loads a collection of entities in a one-to-many association. |
||
240 | * |
||
241 | * @param array $assoc |
||
242 | * @param object $sourceEntity |
||
243 | * @param AbstractLazyCollection $collection The collection to load/fill. |
||
244 | * |
||
245 | * @return Collection |
||
246 | */ |
||
247 | public function loadOneToManyCollection(array $assoc, $sourceEntity, AbstractLazyCollection $collection) |
||
257 | |||
258 | /** |
||
259 | * Returns an array with (sliced or full list) of elements in the specified collection. |
||
260 | * |
||
261 | * @param array $assoc |
||
262 | * @param object $sourceEntity |
||
263 | * @param int|null $limit |
||
264 | * |
||
265 | * @param int|null $offset |
||
266 | * |
||
267 | * @return Collection |
||
268 | */ |
||
269 | 9 | public function getOneToManyCollection(array $assoc, $sourceEntity, $limit = null, $offset = null) |
|
291 | |||
292 | 4 | public function getToOneEntity(array $mapping, $sourceEntity, array $identifiers) |
|
302 | } |
||
303 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.