We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Model validator field message

Hi, I'm using this https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Model_Validator_Uniqueness.html to check in the databse if an email already exist but I can't get the error message "Value of field 'email' is already present in another record". It works but I can't get the message of $this->flash->error($user->getMessages()); because this retuns me "Array". Do you have a solution for that ?



41.3k
Accepted
answer
edited Sep '15

Oh ! I solved my problem with that :

foreach ($user->getMessages() as $message) {
    $this->flash->error($message);
}

Instead of :

$this->flash->error($user->getMessages());