/** * 自我表关联 */ public function getMySelf() { return $this->hasOne(Category::className(), ['id' => 'parent_id']); }
/** * 与产品分类联表 */ public function getCategory() { return $this->hasOne(Category::className(), ['id' => 'category_id']); }