Just a hunch: try adding a fields array, for each model, that contains
either its ID/PK and/or FK to the child model. I've recently noticed
that this sometimes is necessary to get belongsTo associations
contained. Start from the top (Person) and work down.

$this->data = $this->Person->find('first',array(
   'conditions' => array(
       'Person.pk' => $id
   ),
   fields => array('Person.pk'),
   'contain' => array(
       'Study' => array(
           'fields => array('Study.pk'),
           'Series' => array(
               'Instance' => array(
                   'File'
               )
           )
       )
   )
))

I haven't had time to dig further than that so, for now, it's been a
bit of a stab in the dark.

On Tue, Feb 17, 2009 at 6:55 AM, Martin Westin
<[email protected]> wrote:
>
> Hi,
> This is a bit of an odd case. I have a deep association and want to
> paginate the "farthest" model ignoring its relation to the
> intermediate model... As a straight find using containable might
> explain the hierarchy:
>
> $this->data = $this->Person->find('first',array(
>    'conditions' => array(
>        'Person.pk' => $id
>    ),
>    'contain' => array(
>        'Study' => array(
>            'Series' => array(
>                'Instance' => array(
>                    'File'
>                )
>            )
>        )
>    )
> ));
> As anyone can clearly see, this is a "legacy" database that I can't
> alter. (pk is a bit of a tip-off)
>
> This is a series of hasMany (and returning belongsTo)
> Person->Study->Series->Instance->File
>
> I want to paginate the Instances returned no matter if they belongTo
> one of 5 series to fill the "page".
> I want to paginate Files that eventually belongTo Person $id, ignoring
> the intermediate models.
> (I hope that explains it)
>
> I was wondering if there was some , to me, unknown trick to get this
> kind of pagination or if I should just accept a custom query (or some
> hack of my own)?
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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