As mentioned in the Zend Framework manual , I created a base controller.
Subclassification of action controller
By design, Zend_Controller_Action needs subclasses to create an action controller. At a minimum, you will need to determine the methods of action that the controller may cause.
In addition to creating useful features for your web applications, you may also find that you repeat a lot of the same installation method or utility in your various controllers; if so, creating a common base controller class that extends Zend_Controller_Action can solve such redundancy.
But it turns out that Exceptions are not properly called from the database ... To replicate this, create a file:
/path/to/workspace/library/Joe/Controller.php
Then:
class Joe_Controller extends Zend_Controller_Action
{
public function init()
{
Throw new Zend_Exception('test', 500);
parent::init();
}
}
Then, in your controller directory, IndexController.php exits the database:
class IndexController extends Joe_Controller
{
You will find that the exception is not shown.
If, however, you do not extend the base controller and then throw an exception in init or preDispatch, it will be caught and redirected to ErrorController.
Does anyone have an idea to get exceptions found on the base controller?
Thank.
UPDATE TO REDUCE THIS OTHER WAY
, , /Joe/... , , ... , . ?
, , , , :
Joe_Controller_Action Zend_Controller_Action.
, ...
, , , , , ββZend Framework?
, Zend_Exception init preDispatch. , ( , )... . . , - .
, ... Zend_Application, ZF 1.5.