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

  • SEARCH
  • Home
  • 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 6875159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:17:11+00:00 2026-05-27T04:17:11+00:00

I am using Zend Framework and also try to move towards DDD approach (Domain-Driven

  • 0

I am using Zend Framework and also try to move towards DDD approach (Domain-Driven Design). I have models, mappers and DbTables for domain objects.

There are many situations when I need to fetch multiple entities of same time, for example -list of all users within the system-, so my user model will have a method ‘getAllUsers’ which will return all the users (right now its returning an array of all the users, but I am thinking of making a collection class). So far I am using a normal method (non-static) to fetch the collection, and for this purpose, I need to create an ’empty’ object. The other option is to convert it into a static method.

I am not sure, which approach is better, keep such methods as non-static or convert them into static methods. And what is the better approach/practice and why? Also which approach closely follow the DDD methodology.

PS: Kindly let me know, if you can think of a better title. And NO its not a course question.

  • 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-27T04:17:11+00:00Added an answer on May 27, 2026 at 4:17 am

    Static method means that there is no need for instantiated object to call it. Usually static methods are used to group methods that are related to whole class not just particular instance of class. In contrast – non static methods are used to group methods that are related to particular individual object.

    So, if you are marking getAllUsers() non-static and put it underneath user, basically you are asking for one particular user to know about every other user. Using analogy – that would be like asking full information about all citizens in country from one individual citizen (do you know them all in your country?).

    Marking it static would be like asking for information about all citizens from citizen definition in encyclopedia. It’s better than marking it non-static, but still a bit strange and awkward.

    Normally countries have population registers that are responsible for dealing out information about citizens. Converting analogy back – you would have “something else”, collection-like register that is responsible for this.

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

Sidebar

Related Questions

I have a PHP MVC application using Zend Framework. As presented in the quickstart,
Avoiding Fat Controller So I'm using Zend Framework and I have a question involving
I have a social networking website built upon the zend framework. My application also
I'm using Zend Framework and I currently have an existing form using zend-form which
I am using zend framework. I have a text field which is a compulsory
Hi all I am using Zend framework for my PHP project. Basically I have
trying to import a folder of sprites... also using Zend Framework so my setup
I am using Zend Framework and have been trying to do a joined query
I have build a CMS using Zend Framework (1.11). In the application I have
I am using Zend Framework 1.6 hence I'm not utilizing Zend_Application. I have a

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.