1 | <?php |
||
22 | class Entity extends Generic |
||
23 | { |
||
24 | /** @var array Collection of all additional fields names */ |
||
25 | protected static $fieldNames = array(); |
||
26 | |||
27 | /** @var array Collection of localized additional fields identifiers */ |
||
28 | protected static $localizedFieldIDs = array(); |
||
29 | |||
30 | /** @var array Collection of NOT localized additional fields identifiers */ |
||
31 | protected static $notLocalizedFieldIDs = array(); |
||
32 | |||
33 | /** @var array Collection of all additional fields identifiers */ |
||
34 | protected static $fieldIDs = array(); |
||
35 | |||
36 | /** @var @var array Collection of additional fields value column names */ |
||
37 | protected static $fieldValueColumns = array(); |
||
38 | |||
39 | |||
40 | /** @var array Collection of entity field filter */ |
||
41 | protected $fieldFilter = array(); |
||
42 | |||
43 | /** @var string Query locale */ |
||
44 | protected $locale = ''; |
||
45 | |||
46 | /** @var array Collection of ordering parameters */ |
||
47 | protected $orderBy = array(); |
||
48 | |||
49 | /** @var array Collection of limit parameters */ |
||
50 | protected $limit = array(); |
||
51 | |||
52 | /** |
||
53 | * Select specified entity fields. |
||
54 | * If this method is called then only selected entity fields |
||
55 | * would be return in entity instances. |
||
56 | * |
||
57 | * @param mixed $fieldNames Entity field name or collection of names |
||
58 | * @return self Chaining |
||
59 | */ |
||
60 | public function select($fieldNames) |
||
74 | |||
75 | /** |
||
76 | * Set additional field for sorting. |
||
77 | * |
||
78 | * @param string $fieldName Additional field name |
||
79 | * @param string $order Sorting order |
||
80 | * @return self Chaining |
||
81 | */ |
||
82 | public function orderBy($fieldName, $order = 'ASC') |
||
88 | |||
89 | /** |
||
90 | * Set resulting query limits. |
||
91 | * |
||
92 | * @param integer $offset Starting index |
||
93 | * @param integer|null $count Entities count |
||
94 | * @return self Chaining |
||
95 | */ |
||
96 | public function limit($offset, $count = null) |
||
102 | |||
103 | /** |
||
104 | * Add condition to current query. |
||
105 | * |
||
106 | * @param string $fieldName Entity field name |
||
107 | * @param string $fieldValue Value |
||
108 | * @return self Chaining |
||
109 | */ |
||
110 | public function where($fieldName, $fieldValue = null, $fieldRelation = ArgumentInterface::EQUAL) |
||
123 | |||
124 | /** @return array Collection of entity identifiers */ |
||
125 | protected function findEntityIDs() |
||
153 | |||
154 | /** |
||
155 | * Get collection of entity identifiers filtered by navigation identifiers. |
||
156 | * |
||
157 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
158 | * @return array Collection of material identifiers by navigation identifiers |
||
159 | */ |
||
160 | protected function findByNavigationIDs($entityIDs = array()) |
||
164 | |||
165 | /** |
||
166 | * Get collection of entity identifiers filtered by additional field and its value. |
||
167 | * |
||
168 | * @param array $additionalFields Collection of additional field identifiers => values |
||
169 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
170 | * @return array Collection of material identifiers by navigation identifiers |
||
171 | */ |
||
172 | protected function findByAdditionalFields($additionalFields, $entityIDs = array()) |
||
192 | |||
193 | /** |
||
194 | * Add sorting to entity identifiers. |
||
195 | * |
||
196 | * @param array $entityIDs |
||
197 | * @param string $fieldName Additional field name for sorting |
||
198 | * @param string $order Sorting order(ASC|DESC) |
||
199 | * @return array Collection of entity identifiers ordered by additional field value |
||
200 | */ |
||
201 | protected function applySorting(array $entityIDs, $fieldName, $order = 'ASC') |
||
214 | |||
215 | /** |
||
216 | * Get entities additional field values. |
||
217 | * |
||
218 | * @param array $entityIDs Collection of entity identifiers |
||
219 | * @return array Collection of entities additional fields EntityID => [Additional field name => Value] |
||
220 | */ |
||
221 | protected function findAdditionalFields($entityIDs) |
||
278 | |||
279 | /** |
||
280 | * Fill entity additional fields. |
||
281 | * |
||
282 | * @param Entity $entity Entity instance for filling |
||
283 | * @param array $additionalFields Collection of additional field values |
||
284 | * @return Entity With filled additional field values |
||
285 | */ |
||
286 | protected function fillEntityFields($entity, array $additionalFields) |
||
302 | |||
303 | /** |
||
304 | * Perform SamsonCMS query and get collection of entities. |
||
305 | * |
||
306 | * @return \samsoncms\api\Entity[] Collection of entity fields |
||
307 | */ |
||
308 | public function find() |
||
331 | |||
332 | /** |
||
333 | * Perform SamsonCMS query and get first matching entity. |
||
334 | * |
||
335 | * @return \samsoncms\api\Entity Firt matching entity |
||
336 | */ |
||
337 | public function first() |
||
348 | |||
349 | /** |
||
350 | * Perform SamsonCMS query and get collection of entities fields. |
||
351 | * |
||
352 | * @param string $fieldName Entity field name |
||
353 | * @return array Collection of entity fields |
||
354 | * @throws EntityFieldNotFound |
||
355 | */ |
||
356 | public function fields($fieldName) |
||
378 | |||
379 | /** |
||
380 | * Generic constructor. |
||
381 | * |
||
382 | * @param QueryInterface $query Database query instance |
||
383 | * @param string $locale Query localizaation |
||
384 | */ |
||
385 | public function __construct(QueryInterface $query, $locale = NULL) |
||
391 | } |
||
392 |
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: