I'm learning CakePHP 3.X version and I'm really confused about Form validation.
In the documentation (http://book.cakephp.org/3.0/en/core-libraries/form.html) is saying that you need to create a class to validate your form and you have two methods to validate the data.
protected function _buildSchema(Schema $schema)
protected function _buildValidator(Validator $validator)
_buildSchema is used to define the schema data that is used by FormHelper to create an HTML form. You can define field type, length, and precision.
_buildValidator Gets a Cake\Validation\Validator instance that you can attach validators to.
A database schema of a database system is its structure described in a formal language supported by the database management system (DBMS). The term "schema" refers to the organization of data as a blueprint of how the database is constructed.
The schema describes your data structure, your table layout. A blue print.
In computer science, data validation is the process of ensuring that a program operates on clean, correct and useful data. It uses routines, often called "validation rules" "validation constraints" or "check routines", that check for correctness, meaningfulness, and security of data that are input to the system. The rules may be implemented through the automated facilities of a data dictionary, or by the inclusion of explicit application program validation logic.
Validation is the process of checking the data you put into the database, into the schema that describes the structure for your data.
You need to describe your schema first. The data you put into it through the form is validated.
Also the documentation is pretty clear on that as well, I think you just misunderstood it: You can define field type, length, and precision. Defining something is not validating something. :)