Friday, April 22, 2011

Problem with Linking Models

Hi I have problem with Linking Models. Application cannot see
conection between UserData and MainBook. But between User and UserData
it works well. Can you tell why it doesn't work?


class User extends AppModel{
var $name = 'User';

var $hasOne = array(
'UserData'=> array(
'className'=>'UserData',
'foreignKey'=>'user_id'
)
);

}


class UserData extends AppModel{
var $name = 'UserData';

var $hasMany = array(
'MainBook'=>array(
'className' => 'MainBook',
'foreignKey' => 'user_data_id'
)
);

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id'
)
);
}


class MainBook extends AppModel{
var $name = 'MainBook';

var $belongsTo = array(
'UserData' => array(
'className' => 'UserData',
'foreignKey' => 'user_data_id'
)
);
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: