Hi Mike, 

Thank you for reply.
For some reason all replys to my answer were splitted in different part, I'll 
post them here for future reference

http://www.nabble.com/FW%3A-ZF1.8-Right-way-to-get-zend-registry-instance-td23428309.html


and also the follow:

-------------------  B E G I N -----------------------------------
-- Sergio Rinaudo <[email protected]> wrote
(on Thursday, 07 May 2009, 06:50 PM +0200):

> Correct me if I mistake,
> if in my Action Controller I call
> 
> 
> $registry = $this->getInvokeArg('bootstrap')->getContainer();
> 
> the registry object I obtain is different than calling
> 
> $registry = Zend_Registry::getInstance();
 
Yes, these are different. The former is a local registry instance, the
latter a global singleton.
 
Zend_Registry can be used as both a singleton registry as well as a
local registry.
 
When you call Zend_Registry::get(), set(), or getInstance(), you are
using it as a singleton registry, and anytime you call it with one of
those methods, you access the same instance.
 
If you create your registry using:
 
    $registry = new Zend_Registry();
 
you get a local instance. In such a case, you can access its members
either as properties or via array notation:
 
    $config = $registry->config;
    $config = $registry['config'];
 
but the set() and get() methods will not be available.
 
We chose this latter usage within Zend_Application as testing using a
local registry is easier to accomplish than when using a static global
one.

-------------------  E N D -----------------------------------


Sergio Rinaudo





> Date: Thu, 7 May 2009 12:42:18 -0700
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [fw-general] ZF1.8 Right way to get zend registry instance
> 
> Sergio Rinaudo wrote:
> > Hi, 
> > I'm wondering if there is any 'best' or 'right' way to get zend registry 
> > instance within the zf1.8 bootstrap.
> > Thanks.
> 
> How about:
> 
> $registry = Zend_Registry::getInstance();

_________________________________________________________________
Messenger 2009: scaricalo gratis!
http://messenger.it/

Reply via email to