1 | <?php |
||
16 | class CrudEntry |
||
17 | { |
||
18 | /** |
||
19 | * @var CrudFields |
||
20 | */ |
||
21 | protected $fields = []; |
||
22 | |||
23 | /** |
||
24 | * @var Crudable|Model |
||
25 | */ |
||
26 | protected $model; |
||
27 | |||
28 | /** |
||
29 | * @var CrudManager |
||
30 | */ |
||
31 | protected $manager; |
||
32 | |||
33 | /** |
||
34 | * @var CrudValidator |
||
35 | */ |
||
36 | protected $validator; |
||
37 | |||
38 | /** |
||
39 | * CrudEntry constructor. |
||
40 | * |
||
41 | * @param Model|Crudable $model |
||
42 | * @throws \InvalidArgumentException |
||
43 | */ |
||
44 | public function __construct(Model $model) |
||
68 | |||
69 | /** |
||
70 | * @param void |
||
71 | * @return \Generator |
||
72 | */ |
||
73 | public function fields() |
||
83 | |||
84 | /** |
||
85 | * @param void |
||
86 | * @return \Generator |
||
87 | */ |
||
88 | public function formFields() |
||
95 | |||
96 | /** |
||
97 | * Get the entry ID. |
||
98 | * |
||
99 | * @param void |
||
100 | * @return int|mixed |
||
101 | */ |
||
102 | public function getId() |
||
106 | |||
107 | /** |
||
108 | * @param void |
||
109 | * @return string |
||
110 | */ |
||
111 | public function row() |
||
134 | |||
135 | /** |
||
136 | * @param void |
||
137 | * @return CrudFields |
||
138 | */ |
||
139 | public function getFields() |
||
143 | |||
144 | /** |
||
145 | * Resets the validator. |
||
146 | * |
||
147 | * @param void |
||
148 | * @return self |
||
149 | */ |
||
150 | public function resetValidator() |
||
156 | |||
157 | /** |
||
158 | * Shortcut to self validate. |
||
159 | * |
||
160 | * @param array $data |
||
161 | * @return CrudValidator |
||
162 | */ |
||
163 | public function validate(array $data) |
||
167 | |||
168 | /** |
||
169 | * Gets the validator. |
||
170 | * |
||
171 | * @param void |
||
172 | * @return CrudValidator |
||
173 | */ |
||
174 | public function getValidator() |
||
183 | |||
184 | /** |
||
185 | * Saves the model. |
||
186 | * |
||
187 | * @param void |
||
188 | * @return bool |
||
189 | */ |
||
190 | public function save() |
||
194 | |||
195 | /** |
||
196 | * @param void |
||
197 | * @return string |
||
198 | */ |
||
199 | public function __toString() |
||
203 | |||
204 | /** |
||
205 | * @param void |
||
206 | * @return string |
||
207 | */ |
||
208 | public function form() |
||
255 | |||
256 | /** |
||
257 | * Get the entry's model. |
||
258 | * |
||
259 | * @param void |
||
260 | * @return Crudable|Model |
||
261 | */ |
||
262 | public function getModel() |
||
266 | |||
267 | /** |
||
268 | * @param void |
||
269 | * @return CrudManager |
||
270 | */ |
||
271 | public function getManager() |
||
275 | } |
||
276 |
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: