My validator crashed application. I found some answers but they don't seem to work to me. Not sure how to use custom validators under 2.0 below is how my validator looks like and what code adds it. Class is loaded
<?php
$validation->add($fieldName, new PhalconAppLibrary\Validation\Validator\UserNameValidator(array(
'message' => $this->t->_($fieldName.'-invalid')
)));
?>
<?
namespace PhalconAppLibrary\Validation\Validator;
use Phalcon\Validation\Validator,
Phalcon\Validation\ValidatorInterface,
Phalcon\Validation\Message;
class UserNameValidator extends Validator implements ValidatorInterface
{
public function validate($validator, $attribute)
{
return true;
}
}
?>
Doing something like this (and similar things)
>?
public function validate(\Phalcon\Mvc\ModelInterface $validator, $attribute)
?>
doesn't help.
What wrong did i do? I start thinking people don't use custom validators that often :)