Hi, thanks for the reply =)

don't see how that matters, but sure

<?php
class Person extends AppModel {
        var $name = 'Person';
        var $hasAndBelongsToMany = array('Picture');
}
?>

<?php
class Picture extends AppModel {
        var $name = 'Picture';
        var $hasAndBelongsToMany = array('Person', 'Album');
}
?>

<?php
class Album extends AppModel {
        var $name = 'Album';
        var $hasAndBelongsToMany = array('Picture');
}
?>


So a picture may be of more than one person, and each person appears
on many pictures. Each picture may be on different albums, and each
album has many pictures. I have the 3 tables for the models and the 2
for the joins.
Now, like I told you, when I find() the people with default recursion
1, I get a person and all the pictures associated with that person.
When I find() with recursion 2, additionally I get each album of each
picture, BUT NOT all the people associated with that picture again. So
what I want is the 'sister' persons of a person, the ones that appear
on the same picture, but I guess cake isn't doing this to avoid loops
or something, which it clearly wouldn't.

Help? =S

On Nov 18, 1:11 am, the_woodsman <[EMAIL PROTECTED]> wrote:
> You should look into/post your model relationships, there are some
> relevant things in there...
>
> On Nov 17, 3:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Hello
>
> > I wonder if anyone can help me with a specific database design. I have
> > a database with pictures of people. A person may be on different
> > pictures, and a picture may have many people on it (so its a
> > HasAndBelongsTo relation with 3 tables...)
>
> > My problem is that, on a view of a person, I want to list all the
> > pictures of that person, PLUS all other the people that show up in the
> > same photo! So its hard because if try to find() this person with
> > recursion 2, it will fetch the associated pictures, but not the
> > people, since it already passed by the people table. So I'm getting
> > something like this:
>
> > Array
> > (
> >     [Person] => Array
> >         (
> >             [id] => 1
> >             [name] => Bob
> >         )
> >     [Picture] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 114
> >                     [description] => Oh what a nice picture
> >                 )
> >             [1] => Array
> >                 (
> >                     [id] => 115
> >                     [description] => Oh what a lovely picture
> >                 )
> >         )
> > )
>
> > When actually I need something like this:
>
> > Array
> > (
> >     [Person] => Array
> >         (
> >             [id] => 1
> >             [name] => Bob
> >         )
> >     [Picture] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 114
> >                     [description] => Oh what a nice picture
> >                     [Person] => Array(
> >                               [0] => Array (
> >                                        [id] => 2
> >                                        [name] => Alice
> >                              )
> >                 )
> >  (...) and so on
>
> > has anyone come across such a problem? How can I get around it?
> > Thank You
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to