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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:58:06+00:00 2026-05-25T22:58:06+00:00

I have an object that represent’s a User’s account on my site, and a

  • 0

I have an object that represent’s a User’s account on my site, and a separate object that acts as an attachment to the main account object and extends the user’s ability to operate some major functionality on the site – a full functioning storefront.

I have been representing the relationship as so:

Class Account {
    $id
    $store // this is the store object
    $email
    $password
    $status

    get_store() // loads the store
}

Class Store {
    $id // unique store id
    $store_name
    $store_info

    post_item()
}

So far, this has been working great, but when I search or aggregate stores this way, it requires me to go through the Account object to get to the store.

I would like to cut the process in half by being able to also get to the account object through the store.

Does it create a problem to ALSO allow an $account object to be stored in the $store object, just in case I want to load it the other way around?

An example of allowing for this bi-directional loading would be as follows:

Class Account {
    $id
    $store // this is the store object
    $email
    $password
    $status

    get_store() // loads the store
}

Class Store {
    $id
    $account // this is the account object
    $store_name
    $store_info

    get_account() // loads the account
    post_item()
}
  • 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-25T22:58:07+00:00Added an answer on May 25, 2026 at 10:58 pm

    That’s a common refactoring. The only thing you have to be aware of is that you will need to manage the “back pointer” when you associate one object with the other, e.g. when fetching the store for an account, you have to make sure the store will also get the back pointer to that account and vice versa.

    Further reading:

    • Change Unidirectional Association to Bidirectional
    • Same with examples in PHP
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 date object in the database that represent the company's working hours.
I created an object that extends android.view.View , overriding draw() and have it displaying
I have a complex JSON object that I want represent as C# class. I
I have some Result classes that represent flat results in an object oriented fashion.
I have a table which represent an object that has multiple status (approved, expired,
Suppose I have an explicit equation that could represent an object shape in OpenGL,
We have objects that we want to represent in stacks (think of stacking items
I have a Javascript object that basically represents a Row in an .NET GridView.
i have an strongly typed object that represents all of the textbox properties of
My application receives strings that represent objects. I have to parse the strings to

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.