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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:18:18+00:00 2026-06-13T07:18:18+00:00

I have an object in PHP with a composition of objects like: // Settlement

  • 0

I have an object in PHP with a composition of objects like:

// Settlement (DB Fields: id, name)
id = 1, name = 'Meep', jobs = array()
-
// Job (DB Fields: id, action, settlement_id)
id = 1, action = 'build'

So I can do something like: $settlement->getJobs() and it’ll return an array of jobs

When it comes to processing these jobs though I need to know the Settlement as well. So I’m kind of confused as to how it should exist.

Should a Job contain a Settlement and then do something like: $job->getSettlement() or would there be an infinite loop of nesting/composition?

Or when I get the instance from the database to process the job, should I first get the Settlement object containing the Job that’s to be processed so it’s in the same as before?

Within my database the Job is attached to the Settlement via foreign key settlement_id so within my Job entity I wasn’t sure if I should be storing just settlement_id or the entire Settlement but then there’s the nesting/composition loop.

  • 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-06-13T07:18:19+00:00Added an answer on June 13, 2026 at 7:18 am

    It’s perfectly acceptable for nodes to link to each other. You can have an instance of the Settlement whose Job it is inside of the Job object.

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

Sidebar

Related Questions

I have a PHP object like so: Array ( [Apples] => stdClass Object (
I am trying to have a javascript object tree behave like a php associative
I have the following PHP object but I'm struggling to get the array item
I have a PHP Object which contains other objects i.e $obj->sec_obj->some_var; I want to
I am using objects in php. I have an object to connect to database
I have an object, and I am using php's session to persist the objects
I have an object called $definition in PHP. When I print_r($definition); I get Array
I have a useful object written in PHP lets call it my_class.php <?php class
I have a need to create a library of Object Oriented PHP code that
I'm just starting with Object Oriented PHP and I have the following issue: I

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.