Talk:Registry
From Patterns For PHP
While the registry is often implemented as a singleton, I don't think there's any steadfast rules that this need to be the case. If the registry is created and passed in the constructor to the objects, that need it, the static-nature is remedied. In this incarnation, the registry is a very powerful pattern.
- I agree and welcome the comment. While there are varying methods of implementing the Registry, its core purpose does not depend on any specific implementation. A Registry can be accessed as a Singleton, by Parameter or as a static method. The Zend Framework for example has static register()/registry() methods in Zend.php. There are many other examples of broadly different implementations.
- I'll revisit the article in the near future to note all these variations and be more clear on separating a specific implementation from the core pattern.
- As an aside - feel free to make comments on the Forum for corrections and such. These Talk pages aren't checked all that often in comparison. Thanks for the comment!
- --Pádraic 01:43, 2 October 2006 (PDT)
Sometimes we need all the data stored in Registry. I prefer dumping the data with __sleep() magic method. Loading back could be done by instantiating a new Registry object also:
--Julian7 13:54, 25 December 2007 (PST)


