Zend_Application_Bootstrapの設定を取得

6月 4th, 2010 by admin Leave a reply »

Zend_Application_Bootstrap内の各_initでreturnされた設定を取得する方法。


例えば

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initProfiler()
    {
        $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
        $profiler->setEnabled(true);
        $this->db->setProfiler($profiler);
        return $profiler;
    }
 
}

とした場合、controllerでも取り出したい場合が多々ある。
そんな時は
Controller内なら

$Profiler = $this->getInvokeArg('bootstrap')->getResource('Profiler');

ViewやDbなどは特別で取得できるっぽい。

Advertisement

コメントを残す