Hi,
How can I get the field provided by validation messages error when I use the Phalcon validation ?
var_dump :
$messages = $validation->validate($this->request->getPost());
var_dump($messages);
Output :
object(Phalcon\Validation\Message\Group)#77 (2) {
["_position":protected]=>
int(0)
["_messages":protected]=>
array(1) {
[0]=>
object(Phalcon\Validation\Message)#118 (4) {
["_type":protected]=>
string(5) "Email"
["_message":protected]=>
string(23) "The e-mail is not valid"
["_field":protected]=>
string(5) "email"
["_code":protected]=>
int(0)
}
}
}
I want to get theses two variables _message
and _field
.
I tried this $messages->getMessage()
and $messages->getField()
but I have this errors :
Call to undefined method Phalcon\\Validation\\Message\\Group::getMessage()