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 | /** |
||
50 | * Select specified entity fields. |
||
51 | * If this method is called then only selected entity fields |
||
52 | * would be return in entity instances. |
||
53 | * |
||
54 | * @param mixed $fieldNames Entity field name or collection of names |
||
55 | * @return self Chaining |
||
56 | */ |
||
57 | public function select($fieldNames) |
||
71 | |||
72 | /** |
||
73 | * Set additional field for sorting. |
||
74 | * |
||
75 | * @param string $fieldName Additional field name |
||
76 | * @param string $order Sorting order |
||
77 | */ |
||
78 | public function orderBy($fieldName, $order = 'ASC') |
||
82 | |||
83 | /** |
||
84 | * Add condition to current query. |
||
85 | * |
||
86 | * @param string $fieldName Entity field name |
||
87 | * @param string $fieldValue Value |
||
88 | * @return self Chaining |
||
89 | */ |
||
90 | public function where($fieldName, $fieldValue = null, $fieldRelation = ArgumentInterface::EQUAL) |
||
103 | |||
104 | /** @return array Collection of entity identifiers */ |
||
105 | protected function findEntityIDs() |
||
120 | |||
121 | /** |
||
122 | * Get collection of entity identifiers filtered by navigation identifiers. |
||
123 | * |
||
124 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
125 | * @return array Collection of material identifiers by navigation identifiers |
||
126 | */ |
||
127 | protected function findByNavigationIDs($entityIDs = array()) |
||
131 | |||
132 | /** |
||
133 | * Get collection of entity identifiers filtered by additional field and its value. |
||
134 | * |
||
135 | * @param array $additionalFields Collection of additional field identifiers => values |
||
136 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
137 | * @return array Collection of material identifiers by navigation identifiers |
||
138 | */ |
||
139 | protected function findByAdditionalFields($additionalFields, $entityIDs = array()) |
||
159 | |||
160 | /** |
||
161 | * Add sorting to entity identifiers. |
||
162 | * |
||
163 | * @param array $entityIDs |
||
164 | * @param string $fieldName Additional field name for sorting |
||
165 | * @param string $order Sorting order(ASC|DESC) |
||
166 | * @return array Collection of entity identifiers ordered by additional field value |
||
167 | */ |
||
168 | protected function applySorting(array $entityIDs, $fieldName, $order = 'ASC') |
||
181 | |||
182 | /** |
||
183 | * Get entities additional field values. |
||
184 | * |
||
185 | * @param array $entityIDs Collection of entity identifiers |
||
186 | * @return array Collection of entities additional fields EntityID => [Additional field name => Value] |
||
187 | */ |
||
188 | protected function findAdditionalFields($entityIDs) |
||
245 | |||
246 | /** |
||
247 | * Perform SamsonCMS query and get collection of entities. |
||
248 | * |
||
249 | * @return \samsoncms\api\Entity[] Collection of entity fields |
||
250 | */ |
||
251 | public function find() |
||
283 | |||
284 | /** |
||
285 | * Perform SamsonCMS query and get first matching entity. |
||
286 | * |
||
287 | * @return \samsoncms\api\Entity Firt matching entity |
||
288 | */ |
||
289 | public function first() |
||
300 | |||
301 | /** |
||
302 | * Perform SamsonCMS query and get collection of entities fields. |
||
303 | * |
||
304 | * @param string $fieldName Entity field name |
||
305 | * @return array Collection of entity fields |
||
306 | * @throws EntityFieldNotFound |
||
307 | */ |
||
308 | public function fields($fieldName) |
||
330 | |||
331 | /** |
||
332 | * Generic constructor. |
||
333 | * |
||
334 | * @param QueryInterface $query Database query instance |
||
335 | * @param string $locale Query localizaation |
||
336 | */ |
||
337 | public function __construct(QueryInterface $query, $locale = '') |
||
343 | } |
||
344 |
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: