-- Rob Allen <[EMAIL PROTECTED]> wrote
(on Tuesday, 08 May 2007, 07:01 AM +0100):
> Todd Wolaver wrote:
> > Yes, I've just run into this myself and I ended up using
> > the Zend_Controller_Front::getInstance()
> >
> > i.e.
> > $this->_config = Zend_Controller_Front::getInstance()->getParam('config');
> >
> > Todd
> >
>
> Isn't this just like treating the front controller as if it's a
> registry? If so, I would have thought that using Zend_Registry would
> make it more explicit that this is what you are doing?
>
> i.e. what's the benefit of using the FC's setParam() in these cases over
> Zend_Registry?
The idea of adding parameter handling to the front controller arose out
of a desire to reduce the number of dependencies in the front controller
(loose coupling), as well as allow the ability to pass *any* type of
variable through the front controller chain. Zend_Registry is an
object-only registry, so it fails in the second case, and introduces a
dependency in the first.,
As for the need for arbitrary data, as an example, internally there are
several boolean flags you can pass via setParam() that are picked up by
the dispatcher and router in order to customize their behaviours.
As to the benefit of using the front controller params instead of a
registry, it helps keep such objects in a specific domain. Were these
registered in a general global registry, it wouldn't be clear that they
are meant for use with the MVC components specifically. It's really a
matter of preference, but that's certainly one argument I've used.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/