1 | <?php |
||
35 | class UserTypeRelationship implements RelationshipInterface |
||
36 | { |
||
37 | use RelationshipTrait { |
||
38 | reset as parentReset; |
||
39 | newRelations as parentSetCache; |
||
40 | addToRelations as parentAddToCache; |
||
41 | removeFromRelations as parentRemoveFromCache; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @var UserAssociation |
||
46 | */ |
||
47 | private $association; |
||
48 | |||
49 | /** |
||
50 | * @param UserAssociation $association |
||
51 | */ |
||
52 | public function __construct(UserAssociation $association) |
||
56 | |||
57 | |||
58 | /************************************************************ |
||
59 | * COLLECTION |
||
60 | ************************************************************/ |
||
61 | |||
62 | /** |
||
63 | * Get a collection of associated organizations |
||
64 | * |
||
65 | * @return Collection |
||
66 | */ |
||
67 | public function getCollection(): Collection |
||
72 | |||
73 | /** |
||
74 | * @return Collection |
||
75 | */ |
||
76 | protected function existingRelationships(): Collection |
||
84 | |||
85 | /************************************************************ |
||
86 | * QUERY |
||
87 | ************************************************************/ |
||
88 | |||
89 | /** |
||
90 | * @inheritDoc |
||
91 | * @return UserTypeAssociationQuery |
||
92 | */ |
||
93 | private function query(): UserTypeAssociationQuery |
||
102 | |||
103 | /** |
||
104 | * @param UserTypeAssociation|UserType|int|string $type |
||
105 | * @return UserTypeAssociation |
||
106 | */ |
||
107 | protected function create($type): UserTypeAssociation |
||
120 | |||
121 | /** |
||
122 | * Reset associations |
||
123 | */ |
||
124 | public function reset(): RelationshipInterface |
||
129 | |||
130 | |||
131 | /******************************************* |
||
132 | * SAVE |
||
133 | *******************************************/ |
||
134 | |||
135 | /** |
||
136 | * @inheritDoc |
||
137 | */ |
||
138 | protected function delta(): array |
||
169 | |||
170 | /** |
||
171 | * @param UserTypeAssociation $new |
||
172 | * @param UserTypeAssociation $existing |
||
173 | * @return bool |
||
174 | */ |
||
175 | private function hasChanged(UserTypeAssociation $new, UserTypeAssociation $existing): bool |
||
179 | |||
180 | /** |
||
181 | * @param UserTypeAssociation $from |
||
182 | * @param UserTypeAssociation $to |
||
183 | * |
||
184 | * @return UserTypeAssociation |
||
185 | */ |
||
186 | private function sync( |
||
196 | |||
197 | /******************************************* |
||
198 | * COLLECTION UTILS |
||
199 | *******************************************/ |
||
200 | |||
201 | /** |
||
202 | * @inheritDoc |
||
203 | */ |
||
204 | protected function insertCollection(Collection $collection, UserTypeAssociation $association) |
||
213 | |||
214 | /** |
||
215 | * @inheritDoc |
||
216 | */ |
||
217 | protected function updateCollection(Collection $collection, UserAssociation $association) |
||
225 | |||
226 | |||
227 | /******************************************* |
||
228 | * CACHE |
||
229 | *******************************************/ |
||
230 | |||
231 | /** |
||
232 | * @param array $associations |
||
233 | * @return static |
||
234 | */ |
||
235 | protected function newRelations(array $associations): self |
||
242 | |||
243 | /** |
||
244 | * @param $association |
||
245 | * @return static |
||
246 | */ |
||
247 | protected function addToRelations($association): self |
||
254 | |||
255 | /** |
||
256 | * @param int $key |
||
257 | * @return static |
||
258 | */ |
||
259 | protected function removeFromRelations(int $key): self |
||
266 | |||
267 | /******************************************* |
||
268 | * UTILS |
||
269 | *******************************************/ |
||
270 | |||
271 | /** |
||
272 | * @return $this |
||
273 | */ |
||
274 | private function syncToRelations() |
||
282 | |||
283 | /** |
||
284 | * @param UserTypeAssociation|UserType|int|array|null $object |
||
285 | * @return int|null |
||
286 | */ |
||
287 | protected function findKey($object = null) |
||
299 | |||
300 | /** |
||
301 | * @param $identifier |
||
302 | * @return int|string|null |
||
303 | */ |
||
304 | private function findRelationshipKey($identifier) |
||
319 | |||
320 | /** |
||
321 | * @param UserTypeAssociation|UserType|int|array|null $type |
||
322 | * @return UserType|null |
||
323 | */ |
||
324 | protected function resolveObjectInternal($type) |
||
336 | } |
||
337 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: