CakePHP - How to use onError in Model

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-04-29T14:03:08Z Indexed on 2010/04/29 14:07 UTC
Read the original article Hit count: 483

Filed under:
|

I've created a custom datasource which fetches data from a web api, and I'm now looking at implementing error handling.

In the datasource, I'm calling $model->onError(). In the model, I've created the onError method, and I can access error details with $this->getDataSource()->error;

However I can't redirect or set a flash message because that can only take place in the controller, so what should I be doing here to communicate the error to the user?

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about error-handling