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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:27:34+00:00 2026-05-15T14:27:34+00:00

ZF has a very nice feature which is called findManyToManyRowset which returns you directly

  • 0

ZF has a very nice feature which is called findManyToManyRowset which returns you directly a collection of objects from a MN connection. The whole purpose of MN is to get the information from the other table, not from the connection table.

We have this schema:

- users
  - id
  - name

- groups
  - id
  - name

- user_has_groups
  - user_id
  - group_id

I want to create a user function that will return directly a collection of group objects and not a collection of user_has_groups objects.

$user->UserHasGroups ;// returns a collection of user_has_groups
$user->Groups; // returns Doctrine_Record_UnknownPropertyException 

Is there a way to do this directly?

  • 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-15T14:27:35+00:00Added an answer on May 15, 2026 at 2:27 pm

    Doctrine handles this automatically assuming your schema is set up correctly. I only use Doctrine as part of Symfony, so my schema.yml would look something like this. You may need to alter it if your Doctrine install uses a different method to define your schema:

    Users:
      columns:
        name:
          type: string
      relations:
        Groups:
          refClass: UserHasGroups
          local: user_id
          foreign: group_id
    
    Groups:
      columns:
        name:
          type: string
      relations:
        Users:
          refClass: UserHasGroups
          local: group_id
          foreign: id
    
    UserHasGroups
      columns:
        user_id:
          type: integer
          primary: true
        group_id:
          type: integer
          primary: true
    

    Doctrine will use the UserHasGroups class as a many-to-many join table. Then, calling $user->Groups will get you all associated Groups objects.

    As a side note, I would change your model names to the singular form, eg User, Group. $user = new Users() implies at first glance that you’re creating multiple users in one go, which I presume you’re not 🙂

    See the Doctrine join table docs for further details.

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

Sidebar

Related Questions

Spring has a very handy convenience class called PropertyPlaceholderConfigurer , which takes a standard
Eclipse 3.5 has a very nice feature to generate Java hashCode() functions. It would
eclipse has a very nice feature. that is when you debug, it reloads changes
PHP has a very nice function, isset($variableName). It checks if $variableName is already defined
I have an editor I am attempting to emulate that has some very nice
the question is very straightforward: Good DAL library for PHP which has the similar
We know that UIImageView has a very nice support for image sequence animation. We
Earlier on I've implemented a custom C++ server from scratch, something which is nice
My windows phone 7 app has very nice background images but they are being
Windows phone 7 standard pictures app has very nice flicking through images (choose concrete

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.