I have a form and when i validate it to check email address and when i enter wrong email it gives error message but it is not flashing and giving error
"Fatal error: Uncaught TypeError: Argument 1 passed to Phalcon\Flash\AbstractFlash::error() must be of the type string, object given in C:\wamp64\www\phaldemo\app\controllers\UsersController.php on line 152"
Describe what you are trying to achieve and what goes wrong.
My code to get errors on submitting form:
foreach ($user->getMessages() as $message) {
$this->flash->error($message);
}
$message - when i use print_r($message), i am getting this output
Phalcon\Messages\Message Object
(
[code:protected] => 0
[field:protected] => email
[message:protected] => Please enter a correct email address
[type:protected] => Phalcon\Validation\Validator\Email
[metaData:protected] => Array
(
)
)
But this $this->flash->error($message); giving error "Uncaught TypeError: Argument 1 passed to Phalcon\Flash\AbstractFlash::error() must be of the type string, object given"
How i will able to access protected message value "Please enter a correct email address"
I have a form and when i validate it to check email address and when i enter wrong email it gives error message but it is not flashing and giving error "Fatal error: Uncaught TypeError: Argument 1 passed to Phalcon\Flash\AbstractFlash::error() must be of the type string, object given in C:\wamp64\www\phaldemo\app\controllers\UsersController.php on line 152"
$message - when i use print_r($message), i am getting this output Phalcon\Messages\Message Object ( [code:protected] => 0 [field:protected] => email [message:protected] => Please enter a correct email address [type:protected] => Phalcon\Validation\Validator\Email [metaData:protected] => Array ( )
)
But this $this->flash->error($message); giving error "Uncaught TypeError: Argument 1 passed to Phalcon\Flash\AbstractFlash::error() must be of the type string, object given"
How i will able to access protected message value "Please enter a correct email address"