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() |
||
140 | |||
141 | /** |
||
142 | * Get collection of entity identifiers filtered by navigation identifiers. |
||
143 | * |
||
144 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
145 | * @return array Collection of material identifiers by navigation identifiers |
||
146 | */ |
||
147 | protected function findByNavigationIDs($entityIDs = array()) |
||
151 | |||
152 | /** |
||
153 | * Get collection of entity identifiers filtered by additional field and its value. |
||
154 | * |
||
155 | * @param array $additionalFields Collection of additional field identifiers => values |
||
156 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
157 | * @return array Collection of material identifiers by navigation identifiers |
||
158 | */ |
||
159 | protected function findByAdditionalFields($additionalFields, $entityIDs = array()) |
||
179 | |||
180 | /** |
||
181 | * Add sorting to entity identifiers. |
||
182 | * |
||
183 | * @param array $entityIDs |
||
184 | * @param string $fieldName Additional field name for sorting |
||
185 | * @param string $order Sorting order(ASC|DESC) |
||
186 | * @return array Collection of entity identifiers ordered by additional field value |
||
187 | */ |
||
188 | protected function applySorting(array $entityIDs, $fieldName, $order = 'ASC') |
||
201 | |||
202 | /** |
||
203 | * Get entities additional field values. |
||
204 | * |
||
205 | * @param array $entityIDs Collection of entity identifiers |
||
206 | * @return array Collection of entities additional fields EntityID => [Additional field name => Value] |
||
207 | */ |
||
208 | protected function findAdditionalFields($entityIDs) |
||
265 | |||
266 | /** |
||
267 | * Perform SamsonCMS query and get collection of entities. |
||
268 | * |
||
269 | * @return \samsoncms\api\Entity[] Collection of entity fields |
||
270 | */ |
||
271 | public function find() |
||
303 | |||
304 | /** |
||
305 | * Perform SamsonCMS query and get first matching entity. |
||
306 | * |
||
307 | * @return \samsoncms\api\Entity Firt matching entity |
||
308 | */ |
||
309 | public function first() |
||
320 | |||
321 | /** |
||
322 | * Perform SamsonCMS query and get collection of entities fields. |
||
323 | * |
||
324 | * @param string $fieldName Entity field name |
||
325 | * @return array Collection of entity fields |
||
326 | * @throws EntityFieldNotFound |
||
327 | */ |
||
328 | public function fields($fieldName) |
||
350 | |||
351 | /** |
||
352 | * Generic constructor. |
||
353 | * |
||
354 | * @param QueryInterface $query Database query instance |
||
355 | * @param string $locale Query localizaation |
||
356 | */ |
||
357 | public function __construct(QueryInterface $query, $locale = '') |
||
363 | } |
||
364 |
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: