You just need to set the recursive level to fetch the data that is not
directly related. See: http://book.cakephp.org/view/439/recursive

Set it before you do your find, or in the individual action.

On Jan 8, 11:20 pm, Ernesto <[email protected]> wrote:
> Hello and thx for the fast response.
>
> i forgot to paste the var $primaryKey in my model's code. sorry.
>
> everything is working fine in my app. i just can't fetch Location
> Types starting from persons. i'll take a look @ containable behaviour.
>
> thx again
>
> On 8 Gen, 21:43, Webweave <[email protected]> wrote:
>
> > Since you are using "non-standard" names for your ID columns, you need
> > to specify $primaryKey in your models, so your Person model, you would
> > need:
>
> > $primaryKey = 'location_id';
>
> > If you set debug to 2 or 3, you'll see the queries being executed. You
> > may need to set recursive to get the non-related data too, see:
>
> > On Jan 8, 8:09 am, Ernesto <[email protected]> wrote:
>
> > > Hello.
>
> > > i have 3 models
> > > - Person
> > > - Location
> > > - Location_Type
>
> > > pointing respectively @ 3 tables:
>
> > > Persons:
> > > person_id
> > > name
> > > surname
>
> > > Locations:
> > > location_id
> > > person_id
> > > location_type_id
> > > address
> > > country
>
> > > Location_Types:
> > > location_type_id
> > > description
>
> > > the 3 models are linked as follow:
> > > Person hasMany Location
> > > Location belongsTo Location_Type
>
> > > here's the models' code
>
> > > class person extends AppModel {
> > >         var $hasMany = array(
> > >                 "Locations" => array(
> > >                         "className" => "Location",
> > >                         "foreignKey" => "location_id",
> > >                         "dependent" => "true"
> > >                 )
> > >         );
>
> > > }
>
> > > class location extends AppModel {
> > >         var $belongsTo = array(
> > >                 "Location_Type" => array(
> > >                         "className" => "LocationType",
> > >                         "foreignKey" => "location_type_id",
> > >                         "dependent" => "true"
> > >                 )
> > >         );
>
> > > }
>
> > > I can't find out why the "Location_Type"'s data is not showing when i
> > > load data from the "Person" model
>
>
--~--~---------~--~----~------------~-------~--~----~
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