News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Developer Zone:
Deleting indexes from Zend_Registry and why you shouldn't do it !
October 15, 2010 @ 09:19:47

New on the Zend Developer Zone today there's a post that looks at working with the Zend_Registry component of the Zend Framework and how deleting the index out of it directly could be a bad thing for your application.

Zend_Registry is the implementation of the Registry design pattern in the Zend Framework. It is similar to the $_GLOBALS array in pure PHP , but unlike it, it does not provide a transparent way to unset values at a specified index. As you will see in this short article, there is a very simple way to do it, but that doesn't mean it should be done.

He advises against directly using the "_unsetInstance" method that the component provides to remove items from the registry but that could cause unwanted side effects with your data. Instead he recommends using the SPL ArrayObject interfaces and the "offsetUnset" method on the registry instance to drop the item. He ends with a word of warning, though - be careful what you remove in one part of your application because something, somewhere might be depending on it being there, set or not, to make another decision.

0 comments voice your opinion now!
zendregistry zendframework delete index opinion


blog comments powered by Disqus

Similar Posts

Andi Gutmans' Blog: Zend Framework 1.6 Featuring Dojo, SOAP, Testing, and more...

Daniel Cousineau' Blog: A Lesson in Good Architecture

Hari KT's Blog: A simple Blog using Zend framework 1.9

Ben Ramsey's Blog: NY Thoughts and Zend_View_Helper Notes

Raphael Stolt's Blog: Creating Zend Framework snippets for TextMate


Community Events





Don't see your event here?
Let us know!


developer release testing api opinion community threedevsandamaybe introduction laravel unittest code install series language refactor podcast interview framework symfony2 list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework