1 | <?php |
||
22 | trait Object |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * @return string |
||
27 | */ |
||
28 | public abstract static function recordClass(): string; |
||
29 | |||
30 | /** |
||
31 | * @return string |
||
32 | */ |
||
33 | public static function recordClassInstance(): string |
||
37 | |||
38 | /** |
||
39 | * @param array $config |
||
40 | * @return \yii\db\ActiveQuery |
||
41 | */ |
||
42 | public function getRecordQuery($config = []): ActiveQuery |
||
59 | |||
60 | /******************************************* |
||
61 | * CREATE |
||
62 | *******************************************/ |
||
63 | |||
64 | /** |
||
65 | * @param array $attributes |
||
66 | * @param string $toScenario |
||
67 | * @return Record |
||
68 | */ |
||
69 | public function createRecord(array $attributes = [], string $toScenario = null) |
||
90 | |||
91 | /** |
||
92 | * @param $condition |
||
93 | * @param string $toScenario |
||
94 | * @return Record|null |
||
95 | */ |
||
96 | public function findRecordByCondition($condition, string $toScenario = null) |
||
108 | |||
109 | /** |
||
110 | * @param $criteria |
||
111 | * @param string $toScenario |
||
112 | * @return Record |
||
113 | */ |
||
114 | public function findRecordByCriteria($criteria, string $toScenario = null) |
||
129 | |||
130 | /** |
||
131 | * @param $condition |
||
132 | * @param string $toScenario |
||
133 | * @return Record |
||
134 | * @throws RecordNotFoundException |
||
135 | */ |
||
136 | public function getRecordByCondition($condition, string $toScenario = null) |
||
145 | |||
146 | /** |
||
147 | * @param $criteria |
||
148 | * @param string $toScenario |
||
149 | * @return Record |
||
150 | * @throws RecordNotFoundException |
||
151 | */ |
||
152 | public function getRecordByCriteria($criteria, string $toScenario = null) |
||
161 | |||
162 | |||
163 | /** |
||
164 | * @param string $toScenario |
||
165 | * @return Record[] |
||
166 | */ |
||
167 | public function findAllRecords(string $toScenario = null) |
||
171 | |||
172 | /** |
||
173 | * @param array $condition |
||
174 | * @param string $toScenario |
||
175 | * @return Record[] |
||
176 | */ |
||
177 | public function findAllRecordsByCondition($condition = [], string $toScenario = null) |
||
185 | |||
186 | /** |
||
187 | * @param array $criteria |
||
188 | * @param string $toScenario |
||
189 | * @return Record[] |
||
190 | */ |
||
191 | public function findAllRecordsByCriteria($criteria = [], string $toScenario = null) |
||
211 | |||
212 | |||
213 | /** |
||
214 | * @deprecated |
||
215 | * @param array $condition |
||
216 | * @param string $toScenario |
||
217 | * @return Record[] |
||
218 | * @throws RecordNotFoundException |
||
219 | */ |
||
220 | public function getAllRecords($condition = [], string $toScenario = null) |
||
230 | |||
231 | /** |
||
232 | * @param array $condition |
||
233 | * @param string $toScenario |
||
234 | * @return Record[] |
||
235 | * @throws RecordNotFoundException |
||
236 | */ |
||
237 | public function getAllRecordsByCondition($condition = [], string $toScenario = null) |
||
246 | |||
247 | /** |
||
248 | * @param array $criteria |
||
249 | * @param string $toScenario |
||
250 | * @return Record[] |
||
251 | * @throws RecordNotFoundException |
||
252 | */ |
||
253 | public function getAllRecordsByCriteria($criteria = [], string $toScenario = null) |
||
262 | |||
263 | /******************************************* |
||
264 | * EXCEPTIONS |
||
265 | *******************************************/ |
||
266 | |||
267 | /** |
||
268 | * @throws RecordNotFoundException |
||
269 | */ |
||
270 | protected function notFoundRecordException() |
||
279 | } |
||
280 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.