/** * Sets attributes from SQL result row to object. * * @param array $row data from DB * * @return void */ protected function setAttributes(array $row) { parent::setAttributes($row); if (isset($row['blueprintTypeID'])) { $this->producedFromBlueprintId = (int) $row['blueprintTypeID']; } }
/** * */ public function actionCreate() { $model = new Type(); if (($data = Yii::app()->getRequest()->getPost('Type')) !== null) { $model->setAttributes($data); if ($model->save() && $model->storeTypeAttributes(Yii::app()->getRequest()->getPost('attributes', []))) { Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Product type is created')); $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create'])); } } $this->render('create', ['model' => $model, 'availableAttributes' => Attribute::model()->findAll()]); }
public function actionCreate() { $model = new Type(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (($data = Yii::app()->getRequest()->getPost('Type')) !== null) { $model->setAttributes($data); $model->categories = serialize(Yii::app()->getRequest()->getPost('categories')); if ($model->save()) { $model->setTypeAttributes(Yii::app()->getRequest()->getPost('attributes')); Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.type', 'Тип товара создан.')); $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create'])); } } //$criteria = new CDbCriteria(); //$criteria->addNotInCondition('id', CHtml::listData($model->attributeRelation, 'attribute_id', 'attribute_id')); $availableAttributes = Attribute::model()->findAll(); $this->render('create', ['model' => $model, 'availableAttributes' => $availableAttributes]); }
/** * Sets attributes from SQL result row to object. * * @param array $row data from DB * * @return void */ protected function setAttributes(array $row) { parent::setAttributes($row); $this->productId = (int) $row['productTypeID']; $this->maxProductionLimit = (int) $row['maxProductionLimit']; }
/** * Sets attributes from SQL result row to object. Overwrites inherited method. * * @param array $row data from DB * * @return void */ protected function setAttributes(array $row) { //call parent method parent::setAttributes($row); if (isset($row['marketGroupID'])) { $this->marketGroupID = (int) $row['marketGroupID']; } }
/** * Manages all models. */ public function actionAdmin() { $model = new Type('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Type'])) { $model->setAttributes($_GET['Type']); } $this->render('admin', array('model' => $model)); }
/** * Управление Типами форм обучения. * * @return void */ public function actionIndex() { $roles = ['1']; $role = \Yii::app()->user->role; if (array_intersect($role, $roles)) { $model = new Type('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getParam('Type') !== null) { $model->setAttributes(Yii::app()->getRequest()->getParam('Type')); } $this->render('index', ['model' => $model]); } else { throw new CHttpException(403, 'Ошибка прав доступа.'); } }