當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ActiveDataProvider::getCount方法代碼示例

本文整理匯總了PHP中yii\data\ActiveDataProvider::getCount方法的典型用法代碼示例。如果您正苦於以下問題:PHP ActiveDataProvider::getCount方法的具體用法?PHP ActiveDataProvider::getCount怎麽用?PHP ActiveDataProvider::getCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\data\ActiveDataProvider的用法示例。


在下文中一共展示了ActiveDataProvider::getCount方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: existUser

 public function existUser($post)
 {
     $model = new $this->modelClass();
     $query = $model::find()->orFilterWhere(['login' => $post['login']])->orFilterWhere(['email' => $post['email']]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 5]]);
     return $dataProvider->getCount() === 0 ? false : true;
 }
開發者ID:marianturchyn,項目名稱:home,代碼行數:7,代碼來源:UserController.php

示例2: actionList

 public function actionList($event_id)
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $dp = new ActiveDataProvider();
     $dp->query = Comment::find()->with('user')->where(['event_id' => $event_id])->orderBy(['id' => SORT_DESC]);
     $dp->pagination->pageSize = 6;
     return ['items' => $dp->getModels(), 'pageCount' => $dp->getPagination()->getPageCount(), 'totalCount' => $dp->getTotalCount(), 'page' => $dp->pagination->page, 'count' => $dp->getCount()];
 }
開發者ID:KPEMATOP,項目名稱:findspree_old,代碼行數:8,代碼來源:CommentController.php

示例3: getUserReferrer

 public function getUserReferrer($code)
 {
     $query = commonUser::find();
     $query->where('status != ' . commonUser::STATUS_DELETED);
     $query->andwhere('id != ' . Yii::$app->user->id);
     $query->andwhere(['referrer' => $code]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => false]);
     if ($dataProvider->getCount() > 0) {
         return ['dataProvider' => $dataProvider, 'code' => $code, 'parent_checked' => 0];
     }
     return "NULL";
 }
開發者ID:ncuong,項目名稱:lifeguard,代碼行數:12,代碼來源:User.php

示例4: actionSearch

 public function actionSearch()
 {
     if (!empty($_GET)) {
         $model = new $this->modelClass();
         foreach ($_GET as $key => $value) {
             if (!$model->hasAttribute($key)) {
                 throw new \yii\web\HttpException(404, 'Invalid attribute:' . $key);
             }
         }
         try {
             $provider = new ActiveDataProvider(['query' => $model->find()->where($_GET), 'pagination' => false]);
         } catch (Exception $ex) {
             throw new \yii\web\HttpException(500, 'Internal server error');
         }
         if ($provider->getCount() <= 0) {
             throw new \yii\web\HttpException(404, 'No entries found with this query string');
         } else {
             return $provider;
         }
     } else {
         throw new \yii\web\HttpException(400, 'There are no query string');
     }
 }
開發者ID:chimgrrl,項目名稱:auction,代碼行數:23,代碼來源:ProductController.php

示例5: actionEventSubscribers

 /**
  * @param $event_id
  * @return array Вывод подписчиков на страницу события
  * Вывод подписчиков на страницу события
  * @throws \yii\web\NotFoundHttpException
  */
 public function actionEventSubscribers($event_id)
 {
     if (!\Yii::$app->request->isAjax) {
         throw new NotFoundHttpException();
     }
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $dp = new ActiveDataProvider();
     $dp->query = EventSubscriber::find()->with('user')->where(['event_id' => $event_id])->orderBy(['id' => SORT_DESC]);
     $dp->pagination->pageSize = 12;
     return ['items' => $dp->getModels(), 'pageCount' => $dp->getPagination()->getPageCount(), 'totalCount' => $dp->getTotalCount(), 'page' => $dp->pagination->page, 'count' => $dp->getCount()];
 }
開發者ID:KPEMATOP,項目名稱:findspree_old,代碼行數:17,代碼來源:EventController.php

示例6: actionGetUsers

 public function actionGetUsers()
 {
     if (!Yii::$app->user->can("admin")) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     $this->layout = "admin";
     if (Yii::$app->request->isAjax) {
         $code = Yii::$app->request->post('code');
         $parent_checked = Yii::$app->request->post('parent_checked');
         $query = User::find();
         $query->where('status != ' . User::STATUS_DELETED);
         $query->andwhere('id != ' . Yii::$app->user->id);
         $query->andwhere(['referrer' => $code]);
         $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => false]);
         if ($dataProvider->getCount() > 0) {
             return $this->renderAjax("children-user-1", ['dataProvider' => $dataProvider, 'code' => $code, 'parent_checked' => $parent_checked]);
         }
     }
     return "NULL";
 }
開發者ID:ncuong,項目名稱:lifeguard,代碼行數:20,代碼來源:ManageController.php


注:本文中的yii\data\ActiveDataProvider::getCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。