Пример #1
0
 /**
  * Displays a single ObjectTypes model.
  *
  * @param string $id
  *
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $attributesSearchModel = new AttributesSearch();
     $attributesDataProvider = $attributesSearchModel->search(Yii::$app->request->getQueryParams(), true);
     $children = new ArrayDataProvider(['allModels' => $model->getObjectTypes()->all(), 'sort' => ['attributes' => ['id', 'name']], 'pagination' => ['pageSize' => 20]]);
     $attributes = new ArrayDataProvider(['allModels' => $model->getAttrsAll()->with('attributeType')->all(), 'sort' => ['attributes' => ['id', 'name']], 'pagination' => ['pageSize' => 50]]);
     return $this->render('view', ['model' => $model, 'children' => $children, 'attributes' => $attributes, 'parent' => $model->parent_id ? ObjectTypes::findOne($model->parent_id) : null, 'attributesDataProvider' => $attributesDataProvider]);
 }
Пример #2
0
 /**
  * Lists all Attributes models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new AttributesSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
     return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]);
 }