
Class TestRelationModel extends RelationModel{
Protected $tableName = 'goods_trade' ;
Protected $_link = array(
'forum' => array(
'mapping_type' => HAS_ONE ,
'mapping_name' => 'comment' ,
'class_name' => 'forum' ,
'foreign_key' => 'fid' ,
)
);
}
public function index(){
$data = D('TestRelation')->relation(true)->select();
dump($data);
}而将‘mapping_type’换为BELONG_TO时forum中才会出现查询的结果,请问什么原因?
附上数据表结构
明明是一一对应的关系呀!求解释
最佳答案