'.$this['type2']['cname']; if ($this['type3']) { $cname .= '->'.$this['type3']['cname']; } } } return $cname; } public function type1(){ return $this->belongsTo('app\common\model\article\Type','type_1'); } public function type2(){ return $this->belongsTo('app\common\model\article\Type','type_2'); } public function type3(){ return $this->belongsTo('app\common\model\article\Type','type_3'); } public function getStateTextAttr($value,$data){ $state = $data['state']; $text = ['0'=>'草稿','1'=>'发布']; return $text[$state]; } }