Can i get Validation message when i use validationHasFailed function if not how to get messages when validation of the model fails ...?
|
Feb '17 |
6 |
1283 |
0 |
i don't want to save the data in model i just want to know whether validation has failed or nor with failed messages.. i can know if validation had failed using validationHasFailed function. how to get meassges in case validation has failed
i am using Phalcon 3.0 can i use $model->getMessages() without calling validate function by just $model->validationHasFailed ?
So $model->validation() return TRUE or FALSE in case of success and failure of model validation right???
Suppose if there are 3 validations and the model is failed in the first validation itself does it stop there or will it continue validating other 2 validations?
It will continue if you don't provide "cancelOnFail" => true,
option
https://docs.phalcon.io/en/3.0.1/reference/validation.html#cancelling-validations
i am getting getMessage as an object...how can get the only message instead of getting all the object details
object(Phalcon\Mvc\Model\Message)[302]
protected '_type' => string 'Uniqueness' (length=10)
protected '_message' => string 'Username already allotted' (length=25)
protected '_field' => string 'user_name' (length=9)
protected '_model' => null
protected '_code' => int 0