[eluser]goddestroyer[/eluser]
I have developed at least 2 projects using the datamapper and i love it! however, i think this might be my first situation where I have a many-to-many relationship, and i'm looking for the most efficient way to ask for related objects....
the documentation shows that when you have something common like a many-to-one relationship of users to a group, you can use:
Code:
$user->group->get();
to get a handle on the Group object.
(where $user is a User model that has_one Group model).
Now, I have Entries, which can belong to multiple categories. I want to write a loop that just says (pseudocode):
Code:
$categories = new Category();
$categories->get();
foreach($categories as $category){
$entries = $category->entries->get();
...
}
I can't seem to match any of the syntax of the example documentation up to this situation, i know it is right there but i'm not seeing it. What is the best way to get all entries in a category, where entries and categories have a many-to-many relationship?
thank you