1 | <?php |
||
26 | class OrganizationsAssociatedToUserBehavior extends Behavior |
||
27 | { |
||
28 | /** |
||
29 | * @var RelationshipInterface |
||
30 | */ |
||
31 | private $manager; |
||
32 | |||
33 | /** |
||
34 | * Whether associated organizations should be saved |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | private $saveOrganizations = true; |
||
39 | |||
40 | /** |
||
41 | * @return static |
||
42 | */ |
||
43 | public function withOrganizations(): self |
||
48 | |||
49 | /** |
||
50 | * @return static |
||
51 | */ |
||
52 | public function withoutUsers(): self |
||
57 | |||
58 | /** |
||
59 | * @inheritdoc |
||
60 | */ |
||
61 | public function init() |
||
98 | |||
99 | /** |
||
100 | * @param User $user |
||
101 | * @return void |
||
102 | * @throws \Throwable |
||
103 | */ |
||
104 | private function onAfterDelete(User $user) |
||
111 | |||
112 | /** |
||
113 | * @param User|self $user |
||
114 | * @throws Exception |
||
115 | * @throws \Exception |
||
116 | * @throws \Throwable |
||
117 | * @throws \craft\errors\ElementNotFoundException |
||
118 | */ |
||
119 | private function onAfterSave(User $user) |
||
141 | |||
142 | /** |
||
143 | * @param User|self $user |
||
144 | * @return void |
||
145 | */ |
||
146 | private function onAfterValidate(User $user) |
||
150 | |||
151 | /** |
||
152 | * Get an array of associated organizations |
||
153 | * |
||
154 | * @return OrganizationRelationship|RelationshipInterface |
||
155 | */ |
||
156 | public function getOrganizations(): RelationshipInterface |
||
164 | |||
165 | /** |
||
166 | * Set an array or query of organizations to a user |
||
167 | * |
||
168 | * @param $organizations |
||
169 | * @return $this |
||
170 | */ |
||
171 | public function setOrganizations($organizations) |
||
176 | } |
||
177 |
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: