common\models\PostComment::findCommentList PHP Метод

findCommentList() публичный статический Метод

评论列表
public static findCommentList ( $postId ) : static
$postId
Результат static
    public static function findCommentList($postId)
    {
        return static::find()->with('user')->where(['post_id' => $postId]);
    }

Usage Example

Пример #1
0
 /**
  * 话题详细页
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = Topic::findTopic($id);
     $dataProvider = new ActiveDataProvider(['query' => PostComment::findCommentList($id), 'pagination' => ['pageSize' => self::PAGE_SIZE]]);
     // 文章浏览次数
     Topic::updateAllCounters(['view_count' => 1], ['id' => $id]);
     $user = Yii::$app->user->identity;
     $admin = $user && ($user->isAdmin($user->username) || $user->isSuperAdmin($user->username)) ? true : false;
     return $this->render('view', ['model' => $model, 'dataProvider' => $dataProvider, 'comment' => new PostComment(), 'admin' => $admin]);
 }
All Usage Examples Of common\models\PostComment::findCommentList