-- Aurimas Likas <[email protected]> wrote
(on Saturday, 01 May 2010, 08:01 PM +0300):
> In the online documentation there are written:
> 
> 
>     Overriding the getInstance() method ensures that subsequent calls to
>     Zend_Controller_Front::getInstance() will return an instance of your new
>     subclass instead of a Zend_Controller_Front instance
> 
> 
> But this is not true or I misunderstand here something? After extending
> Zend_Controller_Front I tried to:
> $instance = Zend_Controller_Front::getInstance();
> echo get_class($instance); // ouputs Zend_Controller_Front

You need to call your extending class's getInstance() method first; any
subsequent calls to Zend_Controller_Front::getInstance() will then
return that of your extending class.


    $instance = My_Controller_Front::getInstance();   // My_Controller_Front
    $instance = Zend_Controller_Front::getInstance(); // My_Controller_Front


-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply via email to