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