CakePHP3: how use for two difference validation method?

i read official document but i can’t understand all. http://book.cakephp.org/3.0/en/orm/validation.html#validation-vs-application-rules

Is it good for understand to use validation method?

validationDefault is for logic
buildRules is for Schema

Just do it like explained here: http://book.cakephp.org/3.0/en/orm/validation.html#creating-a-default-validation-set

Validation rules validate the data for errors, such as whether an email is actually an email address, and other validation rules that ensure the save() will be successful.

Rules (buildRules) are for application integrity. A common example of this is checking if a user exists before trying to associate a record with them. If this check was skipped, for example, it could lead to a record being inserted into the database that is “broken” because that user doesn’t exist.

If you have specific questions about whether something belongs as a validation rule or application rule, let me know and I’ll try to help out!

1 Like