Hi,
I want to override the default messages that are shown to the user when a field is missing or malformed. So, I have built my own validation()
method in my model. Unfortunately, when a required field is missing, that method never gets called because Phalcon runs its own validation, sees that the fields are missing, then stops.
Is there any way to make my custom validation()
method run first, then have the built-in validation only run if my validation succeeds? Otherwise I don't see a way to change the messages being displayed to the user.
Just for reference, my custom validation method looks like this:
public function validation(){
$this->validate(new \Phalcon\Mvc\Model\Validator\PresenceOf([
'field'=>'first_name',
'message' => 'First name is required'
]));
return $this->validationHasFailed() != true;
}