当前位置: 首页>>代码示例>>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;未经允许,请勿转载。