コード例 #1
0
 public function getNewses($name = '经济')
 {
     return $this->hasMany(News::className(), ['category_id' => 'id'])->where('title = :title', [':title' => $name]);
 }
コード例 #2
0
ファイル: Category.php プロジェクト: BoBRoID/new.k-z
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNews()
 {
     return $this->hasMany(News::className(), ['categoryID' => 'id']);
 }