Skip to content

Commit

Permalink
Update Form README.md to use validationDefault()
Browse files Browse the repository at this point in the history
  • Loading branch information
saeideng committed Dec 25, 2017
1 parent dff88e6 commit e9143dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Form/README.md
Expand Up @@ -25,7 +25,7 @@ class ContactForm extends Form
->addField('body', ['type' => 'text']);
}

protected function _buildValidator(Validator $validator)
public function validationDefault(Validator $validator)
{
return $validator->add('name', 'length', [
'rule' => ['minLength', 10],
Expand All @@ -47,7 +47,7 @@ class ContactForm extends Form
In the above example we see the 3 hook methods that forms provide:

- `_buildSchema()` is used to define the schema data. You can define field type, length, and precision.
- `_buildValidator()` Gets a `Cake\Validation\Validator` instance that you can attach validators to.
- `validationDefault()` Gets a `Cake\Validation\Validator` instance that you can attach validators to.
- `_execute()` lets you define the behavior you want to happen when `execute()` is called and the data is valid.

You can always define additional public methods as you need as well.
Expand Down

0 comments on commit e9143dc

Please sign in to comment.