(on Sunday, 05 December 2010, 05:47 PM +0100):
> Your example is actually (as of a few versions ago) no longer valid,
> Matthew. Nowadays, the modules resource returns the ArrayObject upon
> initialization. You can now do:
Ah, snap! I forgot that we'd done that to make access easier. Thanks for
correcting that!
> $moduleBootstraps = $bootstrap->getResource('modules');
> $blogBootstrap = $moduleBootstraps['blog'];
>
> Or everything on one line:
>
> $blogBootstrap =
> Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('modules')->blog;
>
> Or if you really want to use getExecutedBootstraps you can do:
>
> $bootstrap->getPluginResource('modules')->getExecutedBootstraps();
>
>
> On Fri, Dec 3, 2010 at 8:09 PM, Matthew Weier O'Phinney
> <matthew@zend.com> wrote:
> > -- Marko78 <marko.korhonen@gmail.com> wrote
> > (on Friday, 03 December 2010, 10:13 AM -0800):
> >> I did not mean resources like view, cachemanager etc.
> >>
> >> I mean the module bootstrap classes. I have modules in my application
> >> which all have extended from Zend_Application_Module_Bootstrap.
> >
> > Ah -- you didn't specify that in your original message.
> >
> > You *can* get at them, just not easily, via the "modules" resource. Its
> > "getExecutedBootstraps()" method returns an ArrayObject, where the keys
> > are the module names and the values are the bootstrap objects for the
> > modules.
> >
> > $modules = $bootstrap->getResource('modules');
> > $bootstraps = $modules->getExecutedBootstraps();
> > $blogBootstrap = $bootstraps['blog'];
> >
> >
> >> I would like to have module hook methods in these module bootstrap
> >> classes as they are already loaded. Then I could loop through these
> >> classes if some code wants to invoke some method, e.g. I have content
> >> form, then tag module can alter this form by adding input field for
> >> tags. If I remove or deactivate tag module, content form won't have
> >> tags field anymore. Same goes for handling the post data when saving
> >> content.
> >>
> >> Does this sound weird?
> >>
> >> br, Marko
> >>
> >> -----
> >> br,
> >> --------------------------
> >> Marko Korhonen
> >> Technical Consultant
> >> --
> >> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3071516.html
> >> Sent from the Zend MVC mailing list archive at Nabble.com.
> >>
> >
> > --
> > 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
> >
>
--
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
没有评论:
发表评论