1 | <?php |
||
17 | class CrudEntry |
||
18 | { |
||
19 | /** |
||
20 | * @var CrudFields |
||
21 | */ |
||
22 | protected $fields = []; |
||
23 | |||
24 | /** |
||
25 | * @var Crudable|Model |
||
26 | */ |
||
27 | protected $model; |
||
28 | |||
29 | /** |
||
30 | * @var CrudManager |
||
31 | */ |
||
32 | protected $manager; |
||
33 | |||
34 | /** |
||
35 | * @var CrudValidator |
||
36 | */ |
||
37 | protected $validator; |
||
38 | |||
39 | /** |
||
40 | * CrudEntry constructor. |
||
41 | * |
||
42 | * @param Model|Crudable $model |
||
43 | * @throws \InvalidArgumentException |
||
44 | */ |
||
45 | public function __construct(Model $model) |
||
69 | |||
70 | /** |
||
71 | * @param void |
||
72 | * @return \Generator |
||
73 | */ |
||
74 | public function fields() |
||
81 | |||
82 | /** |
||
83 | * Get the entry ID. |
||
84 | * |
||
85 | * @param void |
||
86 | * @return int|mixed |
||
87 | */ |
||
88 | public function getId() |
||
92 | |||
93 | /** |
||
94 | * @param void |
||
95 | * @return string |
||
96 | */ |
||
97 | public function row() |
||
120 | |||
121 | /** |
||
122 | * @param void |
||
123 | * @return string |
||
124 | */ |
||
125 | public function form() |
||
169 | |||
170 | /** |
||
171 | * Get the entry's model. |
||
172 | * |
||
173 | * @param void |
||
174 | * @return Crudable|Model |
||
175 | */ |
||
176 | public function getModel() |
||
180 | |||
181 | /** |
||
182 | * @param void |
||
183 | * @return CrudManager |
||
184 | */ |
||
185 | public function getManager() |
||
189 | |||
190 | /** |
||
191 | * @param void |
||
192 | * @return CrudFields |
||
193 | */ |
||
194 | public function getFields() |
||
198 | |||
199 | /** |
||
200 | * Resets the validator. |
||
201 | * |
||
202 | * @param void |
||
203 | * @return self |
||
204 | */ |
||
205 | public function resetValidator() |
||
211 | |||
212 | /** |
||
213 | * Shortcut to self validate. |
||
214 | * |
||
215 | * @param array $data |
||
216 | * @return CrudValidator |
||
217 | */ |
||
218 | public function validate(array $data) |
||
222 | |||
223 | /** |
||
224 | * Gets the validator. |
||
225 | * |
||
226 | * @param void |
||
227 | * @return CrudValidator |
||
228 | */ |
||
229 | public function getValidator() |
||
238 | |||
239 | /** |
||
240 | * Saves the model. |
||
241 | * |
||
242 | * @param void |
||
243 | * @return bool |
||
244 | */ |
||
245 | public function save() |
||
249 | |||
250 | /** |
||
251 | * @param void |
||
252 | * @return string |
||
253 | */ |
||
254 | public function __toString() |
||
258 | } |
||
259 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: