Phalcon\Mvc\Model Validation

Hello again :)

I'm still implementing validations and got a new problem. I would like to put all my POST data into my model object and validate two of the fields. In this case it password and passwordconfirm. When I use them in my own Validator I can't access to "passwordconfirm" because it is not an existing column in the database. So the question is, how can I access all the data given in the model. By the way it is not only $_POST it can be also differ.

I saw already that the value which is required to compare are in the snapshot.

Any ideas?

edited Oct '14

Hi Daniel, take a look at incubator's ConfirmationOf validator. You need to add additional public property to your model ($password_confirm), but skip it while initializing using skipAttributes method on create and update actions

class MyModel extends Phalcon\MvcModel
{
    public $password;
    public $password_confirm;
    public function initialize(){
        $this->skipAttributesOnCreate(array('password_confirm'));
        $this->skipAttributesOnUpdate(array('password_confirm'));
    }
    public function validate() {
        $this->validate(new MyOwnValidator(array('field'=>'password', 'confirmation_field'=>'password_confirm')));
    }
}

//somewhere in your validator $this->getOption('confirmation_field')