error handling - CakePHP - How to use onError in Model -
i've created custom datasource fetches data web api, , i'm looking @ implementing error handling.
in datasource, i'm calling $model->onerror(). in model, i've created onerror method, , can access error details $this->getdatasource()->error;
however can't redirect or set flash message because can take place in controller, should doing here communicate error user?
are errors relevant fields in model? if so, use $this->invalidate($field, $message) in model::onerror()
Comments
Post a Comment