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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:07:42+00:00 2026-05-17T18:07:42+00:00

Situation: I have 3 tables: Student, Address, StudentAddressLink As follows Note* not EXACT yaml

  • 0

Situation:

I have 3 tables: Student, Address, StudentAddressLink As follows Note* not EXACT yaml file but you get the idea

Student:  
 column:  
  id: blah blah  
  name: blah blah  
Address:  
 column:  
  id: ~  
  street: ~  
StudentAddressLink:  
 column:  
  id:~  
  student_id: ~  
  address_id: ~  
 relations:  
  Student:  
    local: student_id  
    foreign: id  
   Address:  
     local: address_id  
     foreign: id  

From the Student object I want to get the related “Address Street”
currently I have to do this:

foreach($student->StudentAddressLink as $address)
{
    echo $address->getStreet();
}

This works…but I though there was a way to do something that makes the link table transparent, something magical like this:

foreach($student->Addresss as $address)
{
  echo $address->getStreet();
}

Any direction would be great!

  • 1 1 Answer
  • 2 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-17T18:07:42+00:00Added an answer on May 17, 2026 at 6:07 pm

    If you want many-to-many relations, you need to use something like the code here (for an out of date version of symfony but still correct).

    This involves setting the refClass as StudentAddressLink, allowing the transparent relationship that you want. You will then be able to use $student->Address[0]->getStreet, for example. The documentation there can explain better than I can!


    Edit I think your schema needs to look something like this:

    Student:  
      columns:   
        name: string
      relations:
        Address:
          refClass: StudentAddressLink
          local: student_id
          foreign: address_id
    Address:  
      columns:  
        street: ~
    StudentAddressLink:  
      columns:  
        student_id: ~  
        address_id: ~  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Strange situation. If I have these tables: CREATE TABLE t1 (id INT, title VARCHAR(20),
I have a situation where I have 3 tables: StockItem, Office and StockItemPrice. The
In a situation where I have two tables: Games(id, player1Id, player2Id) Players(id, gender) And
Here is the situation, i have two tables tblProduct and tblCategory, what i am
I have a situation in Oracle where I have two tables - Table A
if our situation is the standard view where you have two tables and a
Here's my situation. I have two tables: pledges and pledge_transactions. When a user makes
I have a situation where I have a database with several tables and large
Situation I have 5 Access DB files, each one has 10 tables, 40 queries
Let me explain the situation I have two tables: -One is to store the

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.