I have a table with multiple columns.
The table has a primary key (response) and two foreign keys (userid and postid).
Here is the table structure: {answerid, content, userid, postid}
The response table received two foreign keys.
I am not sure if the foreign keys are set correctly as follows:
class Post extends AppModel{
var $name = 'Post';
var $useTable = 'post';
var $primaryKey = 'postid';
var $belongsTo = 'User';
var $hasMany = array(
'Reply' => array(
'className' => 'Reply',
'foreignKey' => 'postid',
'foreignKey' => 'userid'
)
);
}
?>
Could you help me?
source
share