I am wondering why you want to do that.

On 23 mrt 2010, at 18:58, Joseph Crawford <[email protected]> wrote:


Hello Everyone,

I am just wondering and would like to get the insight from people who use ZF all day long. I am wondering if this is a good solution or a bad solution
and "why".

So the question is should I make a static method in my Bootstrap.php file that will return an instance of the bootstrap from the registry? Something
kinda like this

public function _initRegistry()
{
   Zend_Registry::set('bootstrap', $this);
}
public static function getInstance()
{
   if(Zend_Registry::isRegistered('bootstrap')) {
       return Zend_Registry::get('bootstrap');
   }
}

then everywhere in my code I can get at the bootstrap by doing $bootstrap =
Bootstrap::getInstance(); rather than

$bootstrap = Zend_Controller_Front::getInstance()->getParam ('bootstrap');

Now I am not asking if I can do this either way because after testing "both
work".  My question is are there reasons why I should or should not
introduce this static method in the Bootstrap file?
--
View this message in context: 
http://n4.nabble.com/Static-Method-in-Bootstrap-File-tp1679460p1679460.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to