yii2: 'required' validator doesn't work on update in REST API
I’m working on a REST API. I extend the default yii\restActiveController and I don’t override any actions. I have this in my model’s rules:
[['status_id', 'priority_id', 'performer_id'], 'required']
But when I try to update a record by sending only {"title":"Some title"}
, it gets updated successfully.
Other core validators work as expected.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (11 by maintainers)
@fernandezekiel
Adding a
required
validation rule doesn’t ensure the submission, it ensures the presence of the value in the current state of the model. You said it yourself in your previous comment.