Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 697829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:12:30+00:00 2026-05-14T03:12:30+00:00

Do you find Zend_Registry useful? For which tasks it should be used? For which

  • 0

Do you find Zend_Registry useful?

For which tasks it should be used? For which not?

Global state for variables is not a good practice.
Main objects may have global state injected via $front->setParam('paramName', $object),
so what’s the purpose of Zend_Registry?.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:12:30+00:00Added an answer on May 14, 2026 at 3:12 am

    Quoting PoEAA on Registry Pattern:

    When you want to find an object you usually start with another object that has an association to it, and use the association to navigate to it. Thus, if you want to find all the orders for a customer, you start with the customer object and use a method on it to get the orders. However, in some cases you won’t have an appropriate object to start with. You may know the customer’s ID number but not have a reference. In this case you need some kind of lookup method – a finder – but the question remains: How do you get to the finder?

    The main reason why I use the registry (when I use it) is because it creates an easily accessible application scope. With the registry, I don’t have to litter objects all over the global scope; only the Registry itself is global. It’s convenient to lookup whatever I’ve thrown into the Registry from everywhere, including the model:

    • Zend_Cache, Zend_Translate, important applications paths, etc

    However, just like with Singletons, Registry is often frowned upon. Here is an article by Brandon Savage with some thought about why not to use the Registry. The main arguments against the Registry are

    • it makes unit-testing harder
    • inexperienced coders might throw too much into it and don’t care about proper design

    Those who vote against the Registry usually advocate the usage of Dependency Injection, although it should be noted that you can inject the Registry as well once you got an instance of it. You do not have Inversion of Control then though, because the using object will pull what it needs from the Registry. Using the Registry as a Service Locator is a valid approach though.

    See this article by Martin Fowler about ServiceLocator vs. Dependency Injection.

    Like pointed out in the comments to your question, Zend_Registry is not a strict Singleton. You can instantiate multiple instances where needed in addition to using the global instance you get with Zend_Registry::getInstance(). So objects can have their own registry. But when using Registry this way, it’s basically just a glorified ArrayObject.

    Final note: just like with all Design Patterns, use it if applicable to your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem, I don't find good examples of autocomplete with zend framework
in all the examples I find of Zend_Form the view showing the form corresponds
find whether there is a loop in a linked list. Do you have other
find . -type f -print prints out ./file1 ./file2 ./file3 Any way to make
find . -type f | xargs file | grep text | cut -d':' -f1
Find out the time complexity (Big Oh Bound) of the recurrence T(n) = T(⌊n⌋)
I find that getting Unicode support in my cross-platform apps a real pain in
I find the concept of the programmable, tiling, keyboard-focuessed window manager ion3 very appealing,
I find from reading perldoc perlvar, about a thousand lines in is help for
I find that the .NET event model is such that I'll often be raising

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.