class CustomerRelationModel extends RelationModel{
protected $tableName = 'customer';
public $_link = array(
'linkman' => array(
'mapping_type' => HAS_MANY,
'class_name' => 'linkman',
'foreign_key' => 'companyId',
'mapping_name' => 'linkmans',
'mapping_fields' => 'id, name, jobs , mobile'
)
);
}这个代码只能查询customer中的字段不能查询子表中的数据 最佳答案