當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。