>From my experience in using registry style systems I've only ever used them
statically, I can't see the point for using it as an object, i.e. 

$registry = new Zend_Registry();

I think from reading the above that is being proposed as an option. If I've
understood correctly, I'd strongly vote against it. The whole point of the
registry is to provide access to variables across an app from within
different classes without having to resort to global variables. If you don't
need access across classes, why bother using the registry?

I agree with Bill that:

$r = Zend_Registry::get();

Invites a level of confusion to usage.

$r = Zend_Registry::getInstance();

Is far better to understand. I've also asked a newbie developer here and I
quickly explained the getInstance functionality and how the code would look
under both circumstance. He found the method name quite understandable and
he has no idea what singleton patterns are. So I think the method name is
logical.

However, I would normally use the registry as so:

$config = Zend_Registry::get('config');
$dbname = $config->db->name;

Though I can see how accessing multiple objects stored in a registry in one
controller is easier (and less code) by using:

$r = Zend_Registry::getInstance();
$dbname = $r->config->db->name;
$bar = $r->foo->bar;

So the current proposal sounds very good to me :-)

However, I have no idea what this is for:

$foo = $r->offsetGet('foo');

best wishes,
Si

Reply via email to