when to use either yii:app()->end() or return sentences? advice needed

Hello people. I need your advice related to when to use either yii:app()->end() or return sentences.

For instance: If you want to terminate any method from any model…


                $f = new LoginForm();





                    //code if not login and then exit...

                    //use yii:app()->end() ?

                    //or use return ?



                [more code....]

So…, which are the differences when use either return or yii:app()->end() to exit from a method?

Thanks in advance.

See if it helps:

end() method

public void end(integer $status=0)

$status integer exit status (value 0 means normal exit while other values mean abnormal exit).

Terminates the application. [size=“4”]This method replaces PHP’s exit() function by calling onEndRequest before exiting.[/size]