Hello,
I have try the new validation from 2.1 beta 2 release but it does not seem to work. Here is the code i have used:
namespace Invo\Models;
use Phalcon\Mvc\Model;
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email as EmailValidator;
use Phalcon\Validation\Validator\Uniqueness as UniquenessValidator;
class Users extends Model
{
public function validation()
{
$validator = new Validation();
$validator->add(
'email',
new EmailValidator()
);
$validator->add(
'username',
new UniquenessValidator(
[
'message' => 'Sorry, That username is already taken',
]
)
);
return $this->validate();
}
}
I got this error: Wrong number of parameters\n#0 /var/www/html/ngsecure/app/models/Users.php(103): Phalcon\Mvc\Model->validate()\n#1