2010年12月3日星期五

Re: [fw-mvc] Where are the module bootstraps objets saved?

-- Marko78 <marko.korhonen@gmail.com> wrote
(on Thursday, 02 December 2010, 11:38 AM -0800):
>
> So I can get them and use their methods from anywhere?

Yes, absolutely.

The bootstrap object has references to them, and if you have the
bootstrap object, you call "getResource($name)" to grab the resource:

$view = $bootstrap->getResource('view');

The bootstrap object is injected into the front controller as a
parameter, which makes it available in your action controllers:

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

Elsewhere, you can grab it from the front controller singleton:

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

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

没有评论: