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 5946241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:47:42+00:00 2026-05-22T16:47:42+00:00

This is a follow up to another question: Bypassing Aggregate Root . The author

  • 0

This is a follow up to another question: Bypassing Aggregate Root.

The author of this question asked if bypassing an aggregate root was acceptable in his example. I have the same question, but for a different use case.

Our web application has a backoffice in which we can edit all of the items that belong to an aggregate root:

  • Products (aggregate root)
  • Options
  • Option items

etc.

Because a product is not created with all of its options in a batch, we edit each entity in the aggregate root, one by one, in a separate screen.
As we are in a stateless system, we need to uniquely identify the entity we want to work on in URL parameters.
This means that we will, for example, fetch & edit an option based on its id, rather than browsing from the root.

IMHO, it makes more sense to have a repository for each of them, and just do:

$optionRepository->find($optionId);

Rather than something like:

foreach ($product->options as $option) {
    if ($option->id == $optionId) {
        // ok, we finally found it, we can now work on it
        // ...
        break;
    }
}

Is that breaking the concept of aggregate roots from domain-driven design? In that case, I would be very grateful to learn the correct way to do that.

  • 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-22T16:47:43+00:00Added an answer on May 22, 2026 at 4:47 pm

    It is breaking the aggregate root concept. There is not a “correct” way to do it. Either you decide to just ignore aggregate root rules and access the objects directly, or you decide to follow aggregate rules and you traverse to the object from the root. You can do it one way or the other, there really is not anything else possible, so there is not any sort of third alternative that represents a “correct” way to both access an object directly and still obey aggregate root rules.

    It is a matter of choice. I personally would break aggregate root rules if there is some sort of compelling reason to do so. Unless the list is huge, what you are suggesting is probably mostly convenient. Is it really even that convenient? You have to create and maintain another repository etc etc.

    The thing is once you create that Options Repository, people are going to use it. Wherever and whenever. And then there is the next scenario, surely you have other similar situations. Let’s create another repository. We did it there why not here too? Pretty soon you might as well have a repository for every object, that is eventually what will happen anyway.

    Not saying that is a good thing or a bad thing. I’ve worked on apps before where there were no formal aggregate roots. All I am saying is it is not really a middle ground sort of thing. If you are going to use them at all, you kind of have to be a stickler about aggregate root rules You either recognize aggregate roots and follow the rules at all times (except maybe under extremely exceptional circumstances, which what you have described is not), or you might as well not have them at all.

    Consistency is probably as important. I would either observe the aggregate roots or do away with the potential burden they can represent altogether.

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

Sidebar

Related Questions

This is a follow-up to another question I asked earlier today. I am creating
This is a follow on from another question i made I have this query
This is a follow up of another question I asked last night. My problem
This is a follow-up question to another SO question of mine . I have
I have a number of xml files that should follow this format: <root> <question>What
This is a follow up of another question here on SO . I have
this is a follow on question to a previously asked question . I have
This is a follow up to another question of mine. The solution I found
this kind of follows on from another question of mine. Basically, once I have
This is a follow on from another question, my question is regarding the use

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.