Thursday, October 1, 2009

Re: find() when having nested models

Hello Brian,

thank you for the information about containable. It works fine, except
for one problem. I use this code:

> $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')
> )
> )
> )
> );

The resulting SQL query for tables A and B are strange. A is called
correctly with "where A.id = C.A_id", but B is calles with "where B.id
= C.id" instead of "where B.id = C.B_id".
I have not the slightest idea why this happens! I retyped the line
several times to be sure I did not make a spelling error. I changed
the order of A and B to check if only the second query contains the
error. But the error seems to be somewhere else.

Does anyone have an idea?

Melanie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: