예제 #1
0
 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]);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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;
 }
예제 #4
0
 public function getItems()
 {
     return $this->model->getItems();
 }