Closed qzminski closed 9 years ago
@Toflar do you agree?
No, you should just not pass the ones that have no inputType
set. Silent skipping is always bad :)
Then maybe we should state that in the documentation? Currently it's not really obvious and the error like Could not find class "" for type ""
is not that obvious.
I see - the message doesn't really help then. We could throw a different exception? As long as this one is also a RuntimeException
it's no BC break :)
What about this:
a)
[...]
if (!isset($arrField['type'])) {
throw new \RuntimeException(sprintf('You did not specify any inputType for the field "%s"!', $strName));
}
[...]
b) Add a callback that filters for all the fields that have an inputType
specified so you don't have to write the same code over and over again but can instead just do:
$form->addFieldsFromDca($table, $hasteBuiltInFilterCallbackName);
This method should skip the fields without set "inputType" as the default use of it would result in an error, e.g. for field
id
ortstamp
which has no input type and thus the exception will be thrown.https://github.com/codefog/contao-haste/blob/master/library/Haste/Form/Form.php#L392