1 | <?php |
||
19 | class Generic |
||
20 | { |
||
21 | /** @var array Collection of all supported entity fields */ |
||
22 | protected static $parentFields = array( |
||
23 | Material::F_PRIORITY => Material::F_PRIORITY, |
||
24 | Material::F_IDENTIFIER => Material::F_IDENTIFIER, |
||
25 | Material::F_DELETION => Material::F_DELETION, |
||
26 | Material::F_PUBLISHED => Material::F_PUBLISHED, |
||
27 | Material::F_PARENT => Material::F_PARENT, |
||
28 | Material::F_CREATED => Material::F_CREATED, |
||
29 | ); |
||
30 | |||
31 | /** @var string Entity identifier */ |
||
32 | protected static $identifier; |
||
33 | |||
34 | /** @var string Entity navigation identifiers */ |
||
35 | protected static $navigationIDs = array(); |
||
36 | |||
37 | /** |
||
38 | * @var string Collection of entity field names |
||
39 | * @deprecated Created for old application who need real additional field names |
||
40 | */ |
||
41 | public static $fieldRealNames = array(); |
||
42 | |||
43 | /** @var string Collection of entity field names */ |
||
44 | public static $fieldNames = array(); |
||
45 | |||
46 | |||
47 | /** @var QueryInterface Database query instance */ |
||
48 | protected $query; |
||
49 | |||
50 | /** @var array Collection of entity fields to retrieved from database */ |
||
51 | protected $selectedFields; |
||
52 | |||
53 | /** @var Condition Query conditions */ |
||
54 | protected $conditions; |
||
55 | |||
56 | /** @var array Collection of ordering parameters */ |
||
57 | protected $orderBy = array(); |
||
58 | |||
59 | /** @var array Collection of limit parameters */ |
||
60 | protected $limit = array(); |
||
61 | |||
62 | /** |
||
63 | * Convert date value to database format. |
||
64 | * TODO: Must implement at database layer |
||
65 | * |
||
66 | * @param string $date Date value for conversion |
||
67 | * @return string Converted date to correct format |
||
68 | */ |
||
69 | protected function convertToDateTime($date) |
||
73 | |||
74 | /** |
||
75 | * Add condition to current query. |
||
76 | * |
||
77 | * @param string $fieldName Entity field name |
||
78 | * @param string $fieldValue Value |
||
79 | * @return $this Chaining |
||
80 | */ |
||
81 | public function where($fieldName, $fieldValue = null, $fieldRelation = ArgumentInterface::EQUAL) |
||
87 | |||
88 | /** |
||
89 | * Set field for sorting. |
||
90 | * |
||
91 | * @param string $fieldName Additional field name |
||
92 | * @param string $order Sorting order |
||
93 | * @return $this Chaining |
||
94 | */ |
||
95 | public function orderBy($fieldName, $order = 'ASC') |
||
103 | |||
104 | /** |
||
105 | * Add primary field query condition. |
||
106 | * |
||
107 | * @param string $value Field value |
||
108 | * @return $this Chaining |
||
109 | * @see Material::where() |
||
110 | */ |
||
111 | public function primary($value) |
||
115 | |||
116 | /** |
||
117 | * Add identifier field query condition. |
||
118 | * |
||
119 | * @param string $value Field value |
||
120 | * @return $this Chaining |
||
121 | * @see Material::where() |
||
122 | */ |
||
123 | public function identifier($value) |
||
127 | |||
128 | /** |
||
129 | * Add active flag condition. |
||
130 | * |
||
131 | * @param bool $value Field value |
||
132 | * @return $this Chaining |
||
133 | * @see Material::where() |
||
134 | */ |
||
135 | public function active($value) |
||
139 | |||
140 | /** |
||
141 | * Add entity published field query condition. |
||
142 | * |
||
143 | * @param string $value Field value |
||
144 | * @return $this Chaining |
||
145 | * @see Material::where() |
||
146 | */ |
||
147 | public function published($value) |
||
151 | |||
152 | /** |
||
153 | * Add entity creation field query condition. |
||
154 | * |
||
155 | * @param string $value Field value |
||
156 | * @param string $relation @see ArgumentInterface types |
||
157 | * @return $this Chaining |
||
158 | * @see Material::where() |
||
159 | */ |
||
160 | public function created($value, $relation = ArgumentInterface::EQUAL) |
||
164 | |||
165 | /** |
||
166 | * Add entity modification field query condition. |
||
167 | * |
||
168 | * @param string $value Field value |
||
169 | * @param string $relation @see ArgumentInterface types |
||
170 | * @return $this Chaining |
||
171 | * @see Material::where() |
||
172 | */ |
||
173 | public function modified($value, $relation = ArgumentInterface::EQUAL) |
||
177 | |||
178 | /** |
||
179 | * Perform SamsonCMS query and get entities collection. |
||
180 | * |
||
181 | * @return \samsoncms\api\Entity[] Collection of found entities |
||
182 | */ |
||
183 | public function find() |
||
197 | |||
198 | /** |
||
199 | * Perform SamsonCMS query and get collection of entities fields. |
||
200 | * |
||
201 | * @param string $fieldName Entity field name |
||
202 | * @return array Collection of entity fields |
||
203 | */ |
||
204 | public function fields($fieldName) |
||
212 | |||
213 | /** |
||
214 | * Perform SamsonCMS query and get first matching entity. |
||
215 | * |
||
216 | * @return \samsoncms\api\Entity First matching entity |
||
217 | */ |
||
218 | public function first() |
||
229 | |||
230 | /** |
||
231 | * Perform SamsonCMS query and get amount resulting entities. |
||
232 | * |
||
233 | * @return int Amount of resulting entities |
||
234 | */ |
||
235 | public function count() |
||
243 | |||
244 | /** |
||
245 | * Generic constructor. |
||
246 | * |
||
247 | * @param QueryInterface $query Database query instance |
||
248 | */ |
||
249 | public function __construct(QueryInterface $query) |
||
254 | } |
||
255 |
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: