I have the validation in my models, and I'm trying to use my custom error messages, but so far I can get only the standard error messages.
Code from my model:
public function validation() {
$this->validate(new PresenceOf(
array(
"field" => "name",
"message" => "Type in your name, please!"
)
));
return $this->validationHasFailed() != true;
}
In one of the actions:
if ($this->request->isPost()) {
if ($supplier->save()) {
//some code here
} else {
foreach ($userModel->getMessages() as $message) {
$this->flashSession->error($message);
}
}
}
And I can get as error message is "name is required". How can I retrieve my custom error messages and pass them to the flash service?