Matthew Weier O'Phinney wrote: > -- 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.,
I'm nearly sure Zend_Registry is no longer object-only. > 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. Oh, I 100% agree with setParam for setting stuff to be picked up by the dispatcher/router. > > 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. Yeah - definitely a toss-up; especially for params that aren't used until you get to the action function itself. I just wanted to ensure that I wasn't missing a clearly better way of doing it :) Personally, I wouldn't pass config or the database adapter around as a front controller param, but that's just me! Regards, Rob...