Skip to content

Commit a8eec1e

Browse files
committed
docs: add sub section titles
1 parent a8a53e7 commit a8eec1e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

user_guide_src/source/models/model.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ prior to saving to the database with the ``insert()``, ``update()``, or ``save()
473473
If you want to check required fields, you can change the behavior by configuration.
474474
See :ref:`clean-validation-rules` for details.
475475

476+
Setting Validation Rules
477+
------------------------
478+
476479
The first step is to fill out the ``$validationRules`` class property with the fields and rules that should
477480
be applied. If you have custom error message that you want to use, place them in the ``$validationMessages`` array:
478481

@@ -528,8 +531,16 @@ The other way to set the validation message to fields by functions,
528531

529532
.. literalinclude:: model/031.php
530533

534+
Getting Validation Result
535+
-------------------------
536+
531537
Now, whenever you call the ``insert()``, ``update()``, or ``save()`` methods, the data will be validated. If it fails,
532-
the model will return boolean **false**. You can use the ``errors()`` method to retrieve the validation errors:
538+
the model will return boolean **false**.
539+
540+
Getting Validation Errors
541+
-------------------------
542+
543+
You can use the ``errors()`` method to retrieve the validation errors:
533544

534545
.. literalinclude:: model/032.php
535546

0 commit comments

Comments
 (0)