-
Notifications
You must be signed in to change notification settings - Fork 1
Bug: rules() "required" is generated before "*_default" #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Though I have already implemented the solution for this issue, I think It can be achieved as $model = new Post;
$model->loadDefaultValues();
if ($model->load($_POST) && $model->validate()) {
} |
This does not really make sense, default applies if empty, using required means it can not be empty. |
I would like to know your use case can be achieved by any below options? Option 1: set default value Option 2: can you please check if |
…rated-before-_default Bug: rules() "required" is generated before "*_default" #22
The automatic generation of rules() first generates 'required' and then 'default' values.
Consequently, default values are not considered when checking 'required'.
The 'required' rules should therefore be generated after 'default'.
Example
schema.yaml
This means that "verified" must be set. If it is not passed in a form, it must be saved as false.
The succession of generic "rules".
ACTUAL STATE
TARGET STATE
The text was updated successfully, but these errors were encountered: