Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

compatible with Phalcon\\Mvc\\Model\\ValidatorInterface

I was following custom model validators of this page,

to build a validators for changing username, if a username exists but not match to current session user, it would return as invalidate.

but I am getting an error of

UniqueValidatorUser::validate() must be compatible with Phalcon\\Mvc\\Model\\ValidatorInterface::validate(Phalcon\\Mvc\\ModelInterface $record)

It was fine with phalcon 1.3.4, but not working with latest 2.0.3

use Phalcon\Mvc\Model\ValidatorInterface;
use Multiple\Models\Users;

class UniqueValidatorUser extends Validator implements ValidatorInterface
    public function validate($model)
        $field = $this->getOption('field');
        $value = $model->$field;
        $di    = DI::getDefault();

        $condition = 'status = ?0 AND '.$field.' = ?1';
        $identity = $di->get('auth')->getIdentity();

            $condition .= ' AND id !='.$identity['id'];
        $users = Users::find([
                        'bind'=>[0=>1, 1=>$value],
                    ]); //** only apply to status=1 user,

            $this->appendMessage("User name exist!", $field, "Unique");
            return FALSE;
        return TRUE;

edited Jul '15

Set EntityInterface type of $model parameter (

public function validate(EntityInterface $model)