當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AttributeGroup::save方法代碼示例

本文整理匯總了PHP中AttributeGroup::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP AttributeGroup::save方法的具體用法?PHP AttributeGroup::save怎麽用?PHP AttributeGroup::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AttributeGroup的用法示例。


在下文中一共展示了AttributeGroup::save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public function save()
 {
     $attributeGroup = AttributeGroup::model()->findByPk($this->id);
     if (is_null($attributeGroup)) {
         // is insert
         $attributeGroup = new AttributeGroup();
         $attributeGroup->sort_order = $this->sortOrder;
         $attributeGroup->save();
         $attributeDescription = new AttributeGroupDescription();
         $attributeDescription->attribute_group_id = $attributeGroup->attribute_group_id;
         $attributeDescription->language_id = 1;
         // TODO: read locale
         $attributeDescription->name = $this->name;
         $attributeDescription->save();
     } else {
         $attributeGroup->sort_order = $this->sortOrder;
         $attributeGroup->save();
         $attributeGroup->description->name = $this->name;
         $attributeGroup->description->save();
     }
 }
開發者ID:damnpoet,項目名稱:yiicart,代碼行數:21,代碼來源:AttributeGroupForm.php

示例2: actionCreate

 public function actionCreate()
 {
     $model = new AttributeGroup();
     $description = new AttributeGroupDescription();
     $this->performAjaxValidation(array($model, $description), 'attribute-group-form');
     if (isset($_POST[$this->modelName])) {
         $model->setAttributes($_POST[$this->modelName]);
         $description->setAttributes($_POST[$this->modelName . 'Description']);
         $suc = Yii::t('info', 'AttributeGroup was successfully created');
         $err = Yii::t('info', 'Could not update AttributeGroup');
         $description->attribute_group_id = 0;
         $description->locale_code = Yii::app()->getLanguage();
         if ($model->validate() && $description->validate()) {
             if ($model->save()) {
                 $description->attribute_group_id = $model->id;
                 $description->save();
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('_view', array('model' => $model, 'description' => $description), false, true);
                     Yii::app()->end();
                 } else {
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             } else {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
             }
         } else {
             $description->validate();
         }
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('_form', array('model' => $model, 'description' => $description), false, true);
         Yii::app()->end();
     }
     $this->render('create', array('model' => $model, 'description' => $description));
 }
開發者ID:Rudianasaja,項目名稱:cycommerce,代碼行數:36,代碼來源:AttributeGroupController.php

示例3: actionGroupCreate

 public function actionGroupCreate()
 {
     if (Yii::app()->getRequest()->getIsPostRequest()) {
         $group = new AttributeGroup();
         $group->name = Yii::app()->getRequest()->getParam('name');
         if ($group->save()) {
             Yii::app()->ajax->success();
         }
         Yii::app()->ajax->failure($group->getErrors());
     }
 }
開發者ID:RonLab1987,項目名稱:43berega,代碼行數:11,代碼來源:AttributeBackendController.php


注:本文中的AttributeGroup::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。