
如图:有表
anwser
anwser_comments
anwser_vote
question
question_comments
question_focus
其中的关联关系是:
question 1:n question_comments
question 1:n question_focus
question 1:n anwser
anwser 1:n anwser_comments
anwser 1:n anwser_vote
然后我在建立一个QuestionModel是
class QuestionModel extends RelationModel {
protected $_link = array (
'anwser' => array (
'mapping_type' => HAS_MANY,
'class_name' => 'anwser',
'mapping_name' => 'anwser',
'foreign_key' => 'question_id'
),
'question_comments' => array (
'mapping_type' => HAS_MANY,
'class_name' => 'question_comments',
'mapping_name' => 'question_comments',
'foreign_key' => 'question_id'
),
'question_focus' => array (
'mapping_type' => HAS_MANY,
'class_name' => 'question_focus',
'mapping_name' => 'question_focus',
'foreign_key' => 'question_id'
)
);
}
在执行删除的时候我想要的效果是:删除一个question当然对应的question_comments和question_focus删除,并且anwser也删除,并且anwser对应的anwser_comments和anwser_vote也删除但是利用关联模型删不掉anwser_comments和anwser_vote的内容
请问官网的关联模型支持多表关联吗?
1.jpg
( 6.48 KB 下载:51 次 )
最佳答案
