Two quick questions / checks.

What does the sql output say?
Is the missing data being queried at all?

What happens if you use recursive instead of containable?

/Martin


On Aug 13, 10:35 am, WebbedIT <[email protected]> wrote:
> I have been trying to debug an issue I am facing for over 3 hours and
> was wondering if someone could give me some pointers.
>
> I have a person.php model which has the following hasMany associations
>
> var $hasMany = array(
>   'OnlineAddress' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('OnlineAddress.parent_model'=>'Person')
>   ),
>   'PostalAddress' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('PostalAddress.parent_model'=>'Person')
>   ),
>   'TelephonyNumber' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('TelephonyNumber.parent_model'=>'Person')
>   )
> );
>
> In my 'people_controller.php' I have a view action, showhn below, with
> a find() using contain
>
> function view($id) {
>   $this->data = $this->Person->find('first', array(
>     'conditions'=>array('Person.id'=>$id),
>     'contain'=>array(
>       'Title',
>       'Gender',
>       'User'=>array('UserGroup'),
>       'OnlineAddress' => array(
>         'conditions' => array('OnlineAddress.parent_model'=>'Person',
> 'OnlineAddress.type_id'=>54)
>       ),
>       'PostalAddress',
>       'TelephonyNumber' => array(
>         'conditions' => array
> ('TelephonyNumber.parent_model'=>'Person',
> 'TelephonyNumber.type_id'=>51)
>       )
>     )
>   ));
>   echo debug($this->data);
>
> }
>
> When I access /People/view/3, which I know has a matching each for
> OnlineAddress and TelephonyNumber it only returns data for
> OnlineAddress ... it doesn't even return empty arrays for
> PostalAddress and TelephonyNumber.
>
> The strangest thing is if I save person.php to test.php and
> people_controller.php to tests_controller.php (setting the test model
> to $useTable='person' and changing the Person references to Test etc.)
> and access /tests/view/3 it returns the expected: 1 record for
> OnlineAddress, empty array for PostalAddress and 1 record for
> TelephonyNumber.
>
> I have had a dig through conainable.php and it seems to be doing it's
> job, seeing the correct associations etc, I am now going to have a dig
> through find which I assume is where the various finds get ran and the
> arrays merged to produce the final result array.
>
> Anyone else had similar issue?
--~--~---------~--~----~------------~-------~--~----~
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