1) Try to respect the naming conventions.
2) Use the containable behavior rather than recursive = 2.
3) Check your data. The code looks ok.

On Feb 23, 11:13 am, Naren <[email protected]> wrote:
> I have three models Country, State and City
>
> I have defined the relationships in the respective models.
>
> class Country extends AppModel
> {
>     var $name = 'Country';
>
>         var $hasMany = array
>         (
>                 'States' => array (
>                         'className'  => 'State',
>                         'foreignKey' => 'countries_id'
>                 )
>         );
>
> }
>
> class State extends AppModel
> {
>     var $name = 'State';
>
>     var $belongsTo =  array
>         (
>                 'Country' => array (
>                         'className'  => 'Country',
>                         'foreignKey' => 'countries_id'
>                 ),
>         );
>
>         var $hasMany = array
>         (
>                 'Cities' => array (
>                         'className'  => 'City',
>                         'foreignKey' => 'states_id'
>                 ),
>         );
>
> }
>
> class City extends AppModel
> {
>     var $name = 'City';
>
>     var $belongsTo =  array
>         (
>                 'State' => array (
>                         'className'  => 'State',
>                         'foreignKey' => 'states_id'
>                 ),
>         );
>
> }
>
> In the StatesController, for pagination i have given the following
> condition
>
>     var $paginate = array(
>         'limit' => 20,
>         'order' => array(
>             'State.name' => 'asc'
>         ),
>        'recursive' => 2
>     );
>
> And i call the paginate like this:
>                 $states = $this->paginate('State');
>
> Still i am not able to get the country columns. Can someone suggest me
> what is happening and why the recursive is not loading the country
> object. i have tried all the soultions i found on the net. Still not
> able to get a solutions for the same. Does this behave differently in
> linux and windows??.
>
> I have to load the State and City object when i paginate cities also
> next. Any solution?? Any solution will be helpful. Thanks.
--~--~---------~--~----~------------~-------~--~----~
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