Get Zend Controller

advertisements

I have an Callback-Method setStatusCallback(). I want to override the Action-Method statusAction() which is placed on my User_IndexController-Class. I know that I can override a Callback-Method to setStatusCallback() using

setStatusCallback(array(&$obj, 'statusAction'));

However, when I write

$obj = new User_IndexController();
setStatusCallback(array(&$obj, 'statusAction'));

this does not work, because User_IndexController() needs $request. How can I get an instance of User_IndexController? I don't know how to handle this $request.


I don't understand why you have to create an instance of a controller object yourself, Zend_Application should do it for you. But if you need to create it yourself, try:

$obj = new User_IndexController(new Zend_Controller_Request_Http(),
                                new Zend_Controller_Response_Http());

You can simply create an instance of a Zend_Controller_Request_Http object and pass it to the Zend_Controller_Action constructor with no special requirements. Hope that helps.