/** * @return \yii\db\ActiveQuery */ public function getPosts() { return $this->hasMany(Post::className(), ['category_id' => 'id']); }