Hi again :) I'd like to create a new Validating Data. When I bake my model, It generates a validation
UsersTable.php -I'm posting only part for example..
public function validationDefault(Validator $validator)
{
$validator
->add('id', 'valid', ['rule' => 'numeric'])
->allowEmpty('id', 'create')
return $validator
}
I would create another.. In it I write validations to another form.. Edit for example
public function validationEditUser(Validator $validator){
...
}
That's how I call validation?
<?= $this->Form->create($user,['context' => ['valitador' => 'validationEditUsers']]); ?>
Is there a process of inheritance among the validations that I created??
UPDATED
I will demonstrate what is currently happening.. This Validation I'm using for my Form Users/Add
public function validationDefault(Validator $validator)
{
$validator
->requirePresence('password', 'create')
->notEmpty('password','Field's empty')
->add('password',[
'minLength' => [
'rule' => ['minLength', 5],
'last' => true,
'message' => 'Password is low, add more characters'
]
])
}
Now, This valdation, I'm using for my form Users/Edit
public function validationEditUsers(Validator $validator){
//Its empty
}
That's the way I'm telling to the form context which validator to use
<?= $this->Form->create($user,['context' => ['valitador' => 'editUsers']]); ?>
What is happening is that message "Password is low.." (belong to "ValidationDefault") is triggered in my form Edit.. I thought that using context would make just validation using ValidationEditUsers.. Why doesn't it happen?