0

I do need to change Zend_Controller_Front and use My_Controller_Front, but I can't figure it out... I have made this:

At My_Controller_Front

    /**
     * Set singleton instance
     */
    public static function setInstance($instance = null) {
        self::$_instance = $instance;
    }

And at my bootstrap

protected function _replaceZendController() {
    Busca_Controller_Front::setInstance(Busca_Controller_Front::getInstance());

    return $this;
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Cito
  • 1,659
  • 3
  • 22
  • 49
  • Any errors or notices? What happens when you make things like this? – Michael Sep 05 '12 at 19:45
  • @360FlowMichael If I throw an Exception it says its loading Zend_Controller_Front instead of Busca_Controller_Front, so basically its not working. – Cito Sep 05 '12 at 19:49
  • what `get_class(Busca_Controller_Front::getInstance())` returns ? – Michael Sep 05 '12 at 20:03
  • 'If I throw an Exception it says its loading Zend_Controller_Front' - how you get this message? Where is it written that Zend_Controller_Front is loading. Maybe your class is loaded. Try to make custom property and then tey to get it in the application after. – Michael Sep 05 '12 at 20:07
  • Question: Why do you need to change the front controller? Just curious. – Keyne Viana Sep 05 '12 at 21:25

1 Answers1

0

From looking at the code I don't think its possible to have Zend_Application use anything other than Zend_Controller_Front.

When you run a Zend_Application, the following things happen:

  • Zend_Application::bootstrap() runs
  • The bootstrap process creates Zend_Application_Bootstrap_Bootstrap which sets up the resource loader and then loads the FrontController resource
  • The Frontcontroller resource is hardcoded to load Zend_Controller_Front (see Zend/Application/Resource/Frontcontroller::getFrontController())

The only way you may be able to change this behavior would be to register your own resource loader which could intercept the loading of the FrontController resource which would load your Front Controller instead of the Zend Front Controller. Of course you would have to make sure your Front Controller supports every option the Zend Framework one does.

So the question is, why do you need to replace Zend_Controller_Front with your own? Can't you set the appropriate options or create plugins to accomplish your goal?

drew010
  • 68,777
  • 11
  • 134
  • 162