In CakePHP, what is a good way to exit or return from controller methods?

In controller methods, there are usually many checks for the “proper operation”.
For example, I check if the user has access to the necessary data.

However, I wonder how best to return or exit these methods when errors occur. I used only a simple return statement, but is there anything more than CakePHP-like and follow the framework design? or is a simple return / exit expression good enough?

+3
source share
1 answer

It really depends on what you want to do.

, , .

, ( ).

, (, ?:)), AppController:: appError() AppError.

. :

http://book.cakephp.org/view/154/Error-Handling

+3

Source: https://habr.com/ru/post/1708598/


All Articles