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


PHP ActiveDataProvider::init方法代码示例

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


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

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!is_callable($this->mapFunction)) {
         throw new \yii\base\InvalidConfigException('You must specify a function for execution `mapFunction`');
     }
 }
开发者ID:cookyii,项目名称:base,代码行数:10,代码来源:CallableActiveDataProvider.php

示例2: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->query instanceof QueryInterface) {
         throw new InvalidConfigException('The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\\db\\Query or its subclasses.');
     }
     $request = \Yii::$app->request;
     if ($request->post('key')) {
         if (!strcmp('history', $request->post('type'))) {
             $this->query->andWhere(['<', 'id', $request->post('key')]);
         } else {
             $this->query->andWhere(['>', 'id', $request->post('key')]);
         }
     }
 }
开发者ID:marciocamello,项目名称:yii2-simplechat,代码行数:18,代码来源:DataProvider.php

示例3: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!$this->category_id) {
         throw new InvalidConfigException('The "category_id" property must be set.');
     }
     $query = Catalog::find()->select(['id', 'title', 'cost', 'category_id'])->where(['category_id' => $this->category_id]);
     $this->categoryAttributes = CatalogAttributes::find()->where(['category_id' => $this->category_id])->orderBy('id')->all();
     $query = (new \yii\db\Query())->select(['t.id', 't.title', 't.cost', 't.category_id'])->from(['t' => $query]);
     foreach ($this->categoryAttributes as $x) {
         $query->addSelect([$x->code . '.value as ' . $x->code]);
         $query->leftJoin([$x->code => (new \yii\db\Query())->from(CatalogValues::tableName())], $x->code . '.catalog_id = t.id and ' . $x->code . '.attribute_id = ' . $x->id);
         $query->addSelect(['categoryAttribute[' . $x->id . ']' => 'categoryAttribute[' . $x->id . '].value']);
         $query->leftJoin(['categoryAttribute[' . $x->id . ']' => (new \yii\db\Query())->from(CatalogValues::tableName())], ['categoryAttribute[' . $x->id . '].catalog_id' => 't.id', 'categoryAttribute[' . $x->id . '].attribute_id' => $x->id]);
     }
     $query = (new \yii\db\Query())->select(['t.*'])->from(['t' => $query]);
     $this->query = $query;
     parent::init();
 }
开发者ID:chameleon82,项目名称:yiindo,代码行数:21,代码来源:CatalogDataProvider.php

示例4: init

 public function init()
 {
     parent::init();
     if (!isset($this->pagination['pageSize'])) {
         $pageSize = (int) Yii::$app->request->get('pageSize') ?: self::DEFAULT_PAGE_SIZE;
         $this->pagination['pageSize'] = $pageSize;
     }
     if (empty($this->filters)) {
         $filters = Yii::$app->request->get('filter');
         if ($filters) {
             $filtersCollection = $filters ? new KendoFiltersCollection($filters) : null;
             $this->filters = $filtersCollection;
         }
     }
     if (!$this->sorting) {
         $sort = Yii::$app->request->get('sort');
         if ($sort) {
             $this->sorting = $sort;
         }
     }
 }
开发者ID:megapixel23,项目名称:kendo-yii2-adapter,代码行数:21,代码来源:KendoDataProvider.php

示例5: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->pageFromPk = Yii::$app->request->get('page-from-pk');
 }
开发者ID:ancor-dev,项目名称:yii2-data,代码行数:8,代码来源:ActiveDataProvider.php

示例6: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
 }
开发者ID:synacksa,项目名称:yii2-cache-data-provider,代码行数:7,代码来源:CacheDataProvider.php


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