How work the method prepareSave?

Hello good day. I need to add validations in my model. How will the new function work?

edited May '16

Just read the docs next time. For model validation you should use validation method -

It will be fired on save method(create/update).

Keep in mind that in 2.1.x validation will change a bit.

edited May '16

Hi. I already updated. And add the following lines

use Phalcon\Validation;
use Phalcon\Mvc\Model\Validator\Email as EmailValidator;
use Phalcon\Mvc\Model\Validator\Uniqueness as UniquenessValidator;

public function validation()
        new UniquenessValidator(
                'field'   => 'CONT_CEDULA',
                'message' => 'Sorry, That username is already taken',

    if ($this->validationHasFailed() == true) {
        return false;

But he stays on a white screen does not work

This mean you have exception, just check logs...


I did not know there were logs How do I check the logs ?. I reviewed the variables in the web browser.

I mean PHP LOGS, white page = means exception, it's not related to phalcon itself, it's related to php, why you are starting working with framework without any knowledge about php ?