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