1 | <?php |
||
26 | trait Accessor |
||
27 | { |
||
28 | /******************************************* |
||
29 | * QUERY |
||
30 | *******************************************/ |
||
31 | |||
32 | /** |
||
33 | * @param array $config |
||
34 | * @return \yii\db\ActiveQuery |
||
35 | */ |
||
36 | abstract public function getQuery($config = []): QueryInterface; |
||
37 | |||
38 | /******************************************* |
||
39 | * CACHE |
||
40 | *******************************************/ |
||
41 | |||
42 | /** |
||
43 | * @return int|null |
||
44 | */ |
||
45 | protected static function cacheDuration() |
||
49 | |||
50 | /** |
||
51 | * @return null|Dependency |
||
52 | */ |
||
53 | protected static function cacheDependency() |
||
57 | |||
58 | /** |
||
59 | * @return Connection |
||
60 | */ |
||
61 | protected static function getDb(): Connection |
||
65 | |||
66 | /******************************************* |
||
67 | * FIND / GET |
||
68 | *******************************************/ |
||
69 | |||
70 | /** |
||
71 | * @return array[] |
||
72 | */ |
||
73 | public function findAll() |
||
77 | |||
78 | /** |
||
79 | * @param $identifier |
||
80 | * @return mixed|null |
||
81 | */ |
||
82 | public function find($identifier) |
||
86 | |||
87 | /** |
||
88 | * @param $identifier |
||
89 | * @return mixed |
||
90 | * @throws NotFoundException |
||
91 | */ |
||
92 | public function get($identifier) |
||
100 | |||
101 | |||
102 | /******************************************* |
||
103 | * ONE CONDITION |
||
104 | *******************************************/ |
||
105 | |||
106 | /** |
||
107 | * @param $condition |
||
108 | * @return mixed|null |
||
109 | */ |
||
110 | public function findByCondition($condition) |
||
116 | |||
117 | /** |
||
118 | * @param $condition |
||
119 | * @return mixed |
||
120 | * @throws NotFoundException |
||
121 | */ |
||
122 | public function getByCondition($condition) |
||
130 | |||
131 | |||
132 | /******************************************* |
||
133 | * ONE CRITERIA |
||
134 | *******************************************/ |
||
135 | |||
136 | /** |
||
137 | * @param $criteria |
||
138 | * @return mixed|null |
||
139 | */ |
||
140 | public function findByCriteria($criteria) |
||
148 | |||
149 | /** |
||
150 | * @param $criteria |
||
151 | * @return mixed |
||
152 | * @throws NotFoundException |
||
153 | */ |
||
154 | public function getByCriteria($criteria) |
||
162 | |||
163 | |||
164 | /******************************************* |
||
165 | * ALL CONDITION |
||
166 | *******************************************/ |
||
167 | |||
168 | /** |
||
169 | * @param array $condition |
||
170 | * @return BaseObject[] |
||
171 | */ |
||
172 | public function findAllByCondition($condition = []): array |
||
178 | |||
179 | /** |
||
180 | * @param array $condition |
||
181 | * @return BaseObject[] |
||
182 | * @throws NotFoundException |
||
183 | */ |
||
184 | public function getAllByCondition($condition = []): array |
||
193 | |||
194 | /******************************************* |
||
195 | * ALL CRITERIA |
||
196 | *******************************************/ |
||
197 | |||
198 | /** |
||
199 | * @param array $criteria |
||
200 | * @return BaseObject[] |
||
201 | */ |
||
202 | public function findAllByCriteria($criteria = []): array |
||
210 | |||
211 | /** |
||
212 | * @param array $criteria |
||
213 | * @return BaseObject[] |
||
214 | * @throws NotFoundException |
||
215 | */ |
||
216 | public function getAllByCriteria($criteria = []): array |
||
225 | |||
226 | |||
227 | /******************************************* |
||
228 | * CACHE |
||
229 | *******************************************/ |
||
230 | |||
231 | /** |
||
232 | * @param QueryInterface $query |
||
233 | * @return mixed|null |
||
234 | */ |
||
235 | protected function queryOne(QueryInterface $query) |
||
253 | |||
254 | /** |
||
255 | * @param QueryInterface $query |
||
256 | * @return mixed[] |
||
257 | */ |
||
258 | protected function queryAll(QueryInterface $query) |
||
276 | |||
277 | /******************************************* |
||
278 | * EXCEPTIONS |
||
279 | *******************************************/ |
||
280 | |||
281 | /** |
||
282 | * @throws NotFoundException |
||
283 | */ |
||
284 | protected function notFoundException() |
||
292 | } |
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: