Use ContainableBehavior and try the find() like:

$this->E->find(
        'all',
        array(
                'contain' => array(
                        'D' => array(
                                'fields' => array('D.title'),
                                'C' => array(
                                        'fields' => array('C.title'),
                                        'A' => array(
                                                'fields' => array('A.title')
                                        ),
                                        'B' => array(
                                                'fields' => array('B.title')
                                        )
                                )
                        ),
                        'F' => array(
                                'fields' => array('F.title')
                        ),
                        'G' => array(
                                'fields' => array('G.title')
                        )
                )
        )
);

or:

$this->E->find(
        'first',
        array(
                'conditions' => array('E.id' => $e_id),
                'contain' => array(
                        ...
                )
        )
);

etc.

On Tue, Sep 29, 2009 at 11:10 AM, Melanie Sommer
<[email protected]> wrote:
>
> Hi,
>
> I have models with belongsTo and hasMany relations in the following
> form:
> A -> C -> D -> E
> B -> C
> F -> E
> G -> E
>
> When displaying E I also want to display the title-fields of A, B, C,
> D, F and G.
>
> find() can only be set to rescursive=2 giving me E together with D, C,
> F, G.
>
> What is the best way of acessing tables A and B? Do I really need query
> () or is there a different way?
>
> Thanks!
> Melanie Sommer
> >
>

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