Symfony models with foreign keys
Posted
by Daniel Hertz
on Stack Overflow
See other posts from Stack Overflow
or by Daniel Hertz
Published on 2010-06-01T20:04:03Z
Indexed on
2010/06/01
20:13 UTC
Read the original article
Hit count: 145
So I have 2 models. Users and Groups. Each group has a user as the creator and a group has many users. The FK of these tables are set up correctly, but I was wondering if there was an easier way to get all related FK objects from other objects. For example, with a group object, is there a built in method to get the user object of the creator? Or for a user, is there a built in method to get all group object that he belongs to? I couldn't find out how to do this with the documentation on the symfony page. From what I see I feel like I need to create methods and use doctrine to access the appropriate tables using the current objects id and so on.
Thanks!
© Stack Overflow or respective owner