Can someone explain why a registry class is needed in an MVC framework?
Is it to load libraries? whats the general idea behind the creation of a registry? what data should be handled by a registry?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Straight from http://www.phppatterns.com/docs/design/the_registry
Basically it means the registry is a place to store your variables/objects that you need in a global scope without polluting the global namespace of your application. It has nothing to do with MVC per se but many MVC frameworks also utilize the Registry pattern.
It allows you to store a variable in one place and retrieve it in another place without having to resort to all kinds of complex routines or magic to retrieve your variables.
Taking Zend Framework for example you create a Zend_Navigation object and store it in the Zend_Registry at bootstrap. Then lateron you can easily retrieve it from the registry in one of you controllers or other classes.