-- Razorblade <[email protected]> wrote
(on Wednesday, 13 May 2009, 04:16 AM -0700):
> I have another question related to the registry.
> If this
> 
> $registry = Zend_Registry::getInstance(); 
> 
> and this
> 
>   $registry =
> Zend_Controller_Front::getInstance()->getParam('bootstrap')->getContainer(); 
> ( or from a controller $registry =
> $this->getInvokeArg('bootstrap')->getContainer();  )
> 
> are different objects, 

Correct.

> which one use in our application?

Either one or both.

> Is there any occurrence where I would to use the one or the other?
> 
> If I set a variable into the static registry, will it be available in the
> non-static one and viceversa??

No; they're separate instances.

Global registries are convenient, as you can access them from anywhere
and not have to worry about passing them in to your objects. However,
they make testing difficult, as it's harder to determine what you true
dependencies are, and when and how to set them. For this reason, we're
using a non-static registry in Zend_Application.

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to