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() |
||
80 | |||
81 | /** |
||
82 | * Get the entry ID. |
||
83 | * |
||
84 | * @param void |
||
85 | * @return int|mixed |
||
86 | */ |
||
87 | public function getId() |
||
91 | |||
92 | /** |
||
93 | * @param void |
||
94 | * @return string |
||
95 | */ |
||
96 | public function row() |
||
119 | |||
120 | /** |
||
121 | * @param void |
||
122 | * @return CrudFields |
||
123 | */ |
||
124 | public function getFields() |
||
128 | |||
129 | /** |
||
130 | * Resets the validator. |
||
131 | * |
||
132 | * @param void |
||
133 | * @return self |
||
134 | */ |
||
135 | public function resetValidator() |
||
141 | |||
142 | /** |
||
143 | * Shortcut to self validate. |
||
144 | * |
||
145 | * @param array $data |
||
146 | * @return CrudValidator |
||
147 | */ |
||
148 | public function validate(array $data) |
||
152 | |||
153 | /** |
||
154 | * Gets the validator. |
||
155 | * |
||
156 | * @param void |
||
157 | * @return CrudValidator |
||
158 | */ |
||
159 | public function getValidator() |
||
168 | |||
169 | /** |
||
170 | * Saves the model. |
||
171 | * |
||
172 | * @param void |
||
173 | * @return bool |
||
174 | */ |
||
175 | public function save() |
||
179 | |||
180 | /** |
||
181 | * @param void |
||
182 | * @return string |
||
183 | */ |
||
184 | public function __toString() |
||
188 | |||
189 | /** |
||
190 | * @param void |
||
191 | * @return string |
||
192 | */ |
||
193 | public function form() |
||
240 | |||
241 | /** |
||
242 | * Get the entry's model. |
||
243 | * |
||
244 | * @param void |
||
245 | * @return Crudable|Model |
||
246 | */ |
||
247 | public function getModel() |
||
251 | |||
252 | /** |
||
253 | * @param void |
||
254 | * @return CrudManager |
||
255 | */ |
||
256 | public function getManager() |
||
260 | } |
||
261 |
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: