Skip to content

Commit 962a0c0

Browse files
committed
docs: add note for validation
1 parent d955f83 commit 962a0c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

user_guide_src/source/models/model.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ For many people, validating data in the model is the preferred way to ensure the
390390
standard, without duplicating code. The Model class provides a way to automatically have all data validated
391391
prior to saving to the database with the ``insert()``, ``update()``, or ``save()`` methods.
392392

393+
.. important:: The validation in the model class only validate provided fields.
394+
So when you set the rule ``required``, if you don't pass the required field data,
395+
the validation won't fail. This is to avoid validation errors when updating only some fields.
396+
393397
The first step is to fill out the ``$validationRules`` class property with the fields and rules that should
394398
be applied. If you have custom error message that you want to use, place them in the ``$validationMessages`` array:
395399

0 commit comments

Comments
 (0)