/** * Создает новую модель атрибута. * Если создание прошло успешно - перенаправляет на просмотр. * * @return void */ public function actionCreate() { $model = new Attribute(); if (($data = Yii::app()->getRequest()->getPost('Attribute')) !== null) { $model->setAttributes($data); if ($model->save() && $model->setTypes(Yii::app()->getRequest()->getPost('types', [])) && $model->setMultipleValuesAttributes(explode(PHP_EOL, $model->rawOptions))) { Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Attribute created')); $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create'])); } } $this->render('create', ['model' => $model, 'types' => Type::model()->findAll()]); }