Tuesday, April 27, 2010

Table relationship making problem to other files

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 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 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: