request-model
request-model copied to clipboard
Support optional fields
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ✔️ |
| Breaks BC? | ✔️ |
| Fixed issues | #15 |
Waiting https://github.com/yiisoft/arrays/pull/80
I agree with @romkatsu. This must be done using a validator.
The validator can't check existence of field.
{orderBy:"name",sort:""} and {orderBy:"name"} for required validator is equal.
Rule::skipOnEmpty doesn't solve this issue?
Required::rule()->when(function ($value, ValidationContext $context) {
return $context->getDataSet()->hasAttribute('relatedAttribute');
})