This is not working in Phalcon 2.0.6 . Sample code (I want to skip password validation on edit):
protected function addPasswordElement()
{
$password = new Text('password');
$password->addValidators([
new PresenceOf([
'message' => 'Password is required',
'allowEmpty' => true,
'cancelOnFail' => true
]),
new StringLength([
'min' => 8,
'messageMinimum' => 'Password is too short. Minimum 8 characters',
'allowEmpty' => true
]),
new Confirmation([
'message' => 'Password does not match confirmation',
'with' => 'confirmPassword',
'allowEmpty' => true
])
]);
$this->add($password);
}
protected function addConfirmPasswordElement()
{
$confirmPassword = new Password('confirmPassword');
$confirmPassword->addValidators([
new PresenceOf([
'message' => 'Confirmation password is required',
'allowEmpty' => true,
'cancelOnFail' => true
])
]);
$this->add($confirmPassword);
}