public function getNewses($name = '经济') { return $this->hasMany(News::className(), ['category_id' => 'id'])->where('title = :title', [':title' => $name]); }
/** * @return \yii\db\ActiveQuery */ public function getNews() { return $this->hasMany(News::className(), ['categoryID' => 'id']); }