/** * @inheritdoc */ public function init() { parent::init(); if ($this->className() == Category::className()) { $this->visible = 1; } }
/** * @return \yii\db\ActiveQuery */ public function getCategory() { return $this->hasOne(Category::className(), ['id' => 'category_id']); }