public function actionCategory($id) { /** @var Item $modelClass */ $modelClass = $this->category->getItems()->modelClass; /** @var Item $model */ $model = new $modelClass(); $attributesBehavior = $model->getAttributesBehavior(); $query = AttributeRuleRecord::find()->byCategory($this->category->id); $dataProvider = new ActiveDataProvider(['query' => $query]); return $this->render('category', ['dataProvider' => $dataProvider, 'categoryId' => $id]); }
public function actionExport($id) { $manager = $this->module->getExportImportManager(); $export = $manager->createExport(['activeDataProvider' => new ActiveDataProvider(['query' => $this->category->getItems()])]); $file = $export->compile(); return $export->download($file); }
public function searchByCategory(Category $category, array $params = []) { $query = $category->getItems(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['defaultPageSize' => 10000, 'pageSizeLimit' => false]]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
public function getItems() { return $this->model->getItems(); }