当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveDataProvider::className方法代码示例

本文整理汇总了PHP中yii\data\ActiveDataProvider::className方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveDataProvider::className方法的具体用法?PHP ActiveDataProvider::className怎么用?PHP ActiveDataProvider::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\data\ActiveDataProvider的用法示例。


在下文中一共展示了ActiveDataProvider::className方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * @param  array $params
  * @return ArrayDataProvider
  */
 public function search(array $params = [])
 {
     $query = (new Query())->select(['name', 'data', 'created_at', 'updated_at'])->from($this->authManager->ruleTable)->orderBy(['name' => SORT_ASC]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('0=1');
     }
     $query->andFilterWhere(['name' => $this->name]);
     return \Yii::createObject(['class' => ActiveDataProvider::className(), 'query' => $query, 'db' => $this->authManager->db, 'sort' => ['attributes' => ['name', 'created_at', 'updated_at']]]);
 }
开发者ID:dektrium,项目名称:yii2-rbac,代码行数:14,代码来源:RuleSearch.php

示例2: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = Yii::createObject(['class' => ActiveDataProvider::className(), 'query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:efabrikov,项目名称:test_yii2_basic,代码行数:21,代码来源:CountrySearch.php

示例3: publicSearch

 /**
  * Возвращает провайдер данных
  * @return ActiveDataProvider
  */
 public function publicSearch()
 {
     $query = $this->find();
     $query->modelClass = get_parent_class($this);
     if ($this->validate()) {
         $query->bySections($this->sectionsIds);
         foreach ($this->metaFields->fields as $field) {
             $field->applySearch($query);
         }
     } else {
         $query->where(new Expression("1!=1"));
     }
     $dataProvider = Yii::createObject(['class' => ActiveDataProvider::className(), "query" => $query]);
     return $dataProvider;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:19,代码来源:CatalogSearch.php

示例4: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerAssets();
     $this->processDelete();
     /** @var Comments\models\Comment $CommentModel */
     $CommentModel = \Yii::createObject(Comments\Module::instance()->model('comment'));
     $CommentsQuery = $CommentModel::find()->byEntity($this->entity);
     if (false === $this->showDeleted) {
         $CommentsQuery->withoutDeleted();
     }
     $CommentsDataProvider = \Yii::createObject(['class' => \yii\data\ActiveDataProvider::className(), 'query' => $CommentsQuery->with(['author', 'lastUpdateAuthor']), 'pagination' => $this->pagination, 'sort' => $this->sort]);
     $params = $this->viewParams;
     $params['CommentsDataProvider'] = $CommentsDataProvider;
     $content = $this->render($this->viewFile, $params);
     return Html::tag('div', $content, $this->options);
 }
开发者ID:rmrevin,项目名称:yii2-comments,代码行数:19,代码来源:CommentListWidget.php

示例5: search

 /**
  * Returns data provider with filled models. Filter applied if needed.
  *
  * @param array $params an array of parameter values indexed by parameter names
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $this->load($params) && $this->validate();
     /** @var \yii\db\BaseActiveRecord $Model */
     $Model = Instance::ensure(['class' => Changelog::className()]);
     /** @var ChangelogQuery $ChangelogQuery */
     $ChangelogQuery = $Model::find();
     if (!empty($this->action)) {
         $ChangelogQuery->byAction($this->action);
     }
     if (!empty($this->entity_type)) {
         $ChangelogQuery->byEntityType($this->entity_type);
     }
     if (!empty($this->entity_id)) {
         $ChangelogQuery->byEntityId($this->entity_id);
     }
     /** @var ActiveDataProvider $DataProvider */
     $DataProvider = \Yii::createObject(['class' => ActiveDataProvider::className(), 'query' => $ChangelogQuery, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     return $DataProvider;
 }
开发者ID:rmrevin,项目名称:yii2-changelog,代码行数:26,代码来源:ChangelogSearch.php

示例6: publicSearch

 /**
  * Возвращает провайдер данных для отображения списка фотогалерей в публичной части
  * @return \yii\data\ActiveDataProvider
  * @throws \yii\base\InvalidConfigException
  */
 public function publicSearch()
 {
     $query = $this->find()->published();
     $dataProvider = Yii::createObject(['class' => ActiveDataProvider::className(), "query" => $query]);
     return $dataProvider;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:11,代码来源:Gallery.php

示例7: getDataProvider

 /**
  * Возвращает объект провайдера данных
  * @return object|ActiveDataProvider
  * @throws \yii\base\InvalidConfigException
  */
 public function getDataProvider()
 {
     if (is_null($this->_dataProvider)) {
         $query = Review::find()->published()->byItem($this->itemId, $this->modelClass);
         if (is_callable($this->queryModifier)) {
             $func = $this->queryModifier;
             $func($query);
         }
         $config = ArrayHelper::merge($this->dataProviderConfig, ['class' => ActiveDataProvider::className(), 'query' => $query]);
         $this->_dataProvider = Yii::createObject($config);
         $this->_dataProvider->pagination->pageSize = $this->pageSize;
         $this->_dataProvider->sort->defaultOrder = $this->orderBy;
     }
     return $this->_dataProvider;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:20,代码来源:ReviewList.php

示例8: search

 /**
  * Возвращает провайдер данных для поиска
  * @param array $params массив значений атрибутов модели
  * @param array $dataProviderConfig параметры провайдера данных
  * @param \common\db\ActiveQuery $query запрос
  * @return \yii\data\ActiveDataProvider
  */
 public function search($params, $dataProviderConfig = [], $query = null)
 {
     $fields = $this->getMetaFields()->getFields();
     $query = $query ? $query : static::find();
     $config = array_merge(['class' => ActiveDataProvider::className(), "query" => $query], $dataProviderConfig);
     $dataProvider = Yii::createObject($config);
     $dataProvider->getSort()->defaultOrder = $this->_defaultSearchOrder;
     $this->load($params);
     $this->validate();
     foreach ($fields as $field) {
         if ($field->search) {
             $field->applySearch($query);
         }
     }
     return $dataProvider;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:23,代码来源:ActiveRecord.php

示例9: searchBySection

 /**
  * Поиск новостей по категориям. Если идентификаторы категорий не заданы выбираются все элементы.
  * @param null|array $ids массив идентификаторов категорий
  * @return \yii\data\ActiveDataProvider провайдер данных
  * @throws \yii\base\InvalidConfigException
  */
 public function searchBySection($ids = null)
 {
     $query = $this->find()->bySections($ids);
     $dataProvider = Yii::createObject(['class' => ActiveDataProvider::className(), "query" => $query]);
     return $dataProvider;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:12,代码来源:News.php

示例10: dataProviderClassName

 /**
  * Имя класса дата-провайдера
  * @return string
  */
 public function dataProviderClassName()
 {
     return ActiveDataProvider::className();
 }
开发者ID:maybeworks,项目名称:yii2-libs,代码行数:8,代码来源:SearchTrait.php

示例11: getDataProvider

 /**
  * Returns data provider for contacts
  * @return object|ActiveDataProvider
  * @throws \yii\base\InvalidConfigException
  */
 public function getDataProvider()
 {
     if (is_null($this->_dataProvider)) {
         $query = Contact::find()->byUser($this->userId)->with(['lastMessage', 'lastMessageAuthor']);
         if (is_callable($this->queryModifier)) {
             $func = $this->queryModifier;
             $func($query);
         }
         $this->_dataProvider = Yii::createObject(ArrayHelper::merge(['class' => ActiveDataProvider::className(), 'query' => $query], $this->dataProviderOptions));
         $this->_dataProvider->sort->defaultOrder = $this->defaultOrder;
         $this->_dataProvider->pagination->pageSize = $this->pageSize;
     }
     return $this->_dataProvider;
 }
开发者ID:nanson,项目名称:yii2-messenger,代码行数:19,代码来源:Contacts.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     $skin = $this->skinAsset;
     if ($skin) {
         $skin::register($this->view);
     }
     CommentsAsset::register($this->view);
     $parent = Model::findOne(TActiveRecord::ROOT_ID);
     $query = $parent->children()->published()->andWhere(["model" => $this->modelClass, "item_id" => $this->itemId]);
     if (is_callable($this->queryModifier)) {
         $func = $this->queryModifier;
         $func($query);
     }
     $config = array_merge(['class' => ActiveDataProvider::className(), "query" => $query], $this->dataProviderConfig);
     $this->dataProvider = Yii::createObject($config);
     $this->dataProvider->getPagination()->pageSize = $this->pageSize;
     $id = $this->getId();
     $this->view->registerJs("\$('#{$id}').commentsWidget()");
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:22,代码来源:Comments.php


注:本文中的yii\data\ActiveDataProvider::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。