示例#1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getKskComments()
 {
     return $this->hasMany(KskComments::className(), ['post_id' => 'id'])->joinWith('user')->orderBy(['parent' => SORT_ASC, 'created_date' => SORT_ASC]);
 }
 /**
  * Finds the KskComments model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return KskComments the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = KskComments::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }