/** * @inheritdoc */ public function init() { parent::init(); if (!is_callable($this->mapFunction)) { throw new \yii\base\InvalidConfigException('You must specify a function for execution `mapFunction`'); } }
/** * @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')]); } } }
/** * @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(); }
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; } } }
/** * @inheritdoc */ public function init() { parent::init(); $this->pageFromPk = Yii::$app->request->get('page-from-pk'); }
/** * @inheritdoc */ public function init() { parent::init(); }