直接示例:
其中,PondFishLog和Pond有关系,Pond和FishCenter有关系,则使用上面的代码就可以实现数据的查询。
PondFishLog::model()->with(array(
'pond'=>array(
'select'=>array('pondname'),
'with'=>array(
'fishcenter'=>array(
'select'=>'fcname'
),
),
),
))->findAll(array(
'select'=>array('fishid','pondid','fishname','weight','dateline','filepath'),
'condition'=>'t.pondid ='.$id,
'order'=>'t.id DESC',
'limit'=>3,
));
其中,PondFishLog和Pond有关系,Pond和FishCenter有关系,则使用上面的代码就可以实现数据的查询。