You have to understand how the CakePHP model works. See the recursive
attribute of the model here:
http://book.cakephp.org/view/71/Model-Attributes#recursive-439

When you know how it works, try then to look at the Containable
behaviour, which will save your time in the future, when you want to
retrieve data from a model and associated/related models.
http://book.cakephp.org/view/474/Containable

Enjoy your time with CakePHP,
   John

On Apr 27, 2:47 pm, Ambika Kulkarni <[email protected]>
wrote:
> Hi all,
>
> I have 2 models such as below.
> class Division extends AppModel {
>     var $name = 'Division';
>     var $primaryKey = 'division_id';
>     var $hasMany = array(
>                    'Store' => array(
>                               'className' => 'Store',
>                               'foreignKey' => 'division_id',
>                               'conditions' => '',
>                               'fields' => '',
>                               'order' => ''));
>
>     var $belongsTo = array(
>                      'Country' => array(
>                                   'className' => 'Country',
>                                   'foreignKey' => 'country_id',
>                                   'conditions' => '',
>                                   'fields' => '',
>                                   'order' => ''));
>
> }
>
> class Country extends AppModel {
>     var $name = 'Country';
>     var $primaryKey = 'country_id';
>     var $hasMany = array(
>                    'Division' => array(
>                                  'className' => 'division',
>                                  'foreignKey' => 'country_id',
>                                  'dependent' => false,
>                                  'conditions' => '',
>                                  'fields' => '',),);}
>
> Now i want to fetch the data only from division table. but I am
> getting the whole data from both tables.
>
> Thanks
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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