当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveRecordModel::save方法代码示例

本文整理汇总了PHP中ActiveRecordModel::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::save方法的具体用法?PHP ActiveRecordModel::save怎么用?PHP ActiveRecordModel::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActiveRecordModel的用法示例。


在下文中一共展示了ActiveRecordModel::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save()
 {
     $this->load();
     $this->userAddress->get()->load();
     $this->userAddress->get()->save();
     return parent::save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:UserAddressType.php

示例2: save

 public function save()
 {
     if (!$this->orderedItem->get()->customerOrder->get()->isFinalized->get()) {
         $this->updatePriceDiff();
     }
     return parent::save();
 }
开发者ID:GregerA,项目名称:livecart,代码行数:7,代码来源:OrderedItemOption.php

示例3: save

 protected function save(ActiveRecordModel $listGroup)
 {
     $validator = $this->buildValidator();
     if ($validator->isValid()) {
         $listGroup->loadRequestData($this->request);
         $listGroup->save();
         return new JSONResponse(array('ID' => $listGroup->getID(), 'data' => $listGroup->toArray()), 'success');
     } else {
         return new JSONResponse(array('errors' => $validator->getErrorList()), 'failure');
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:11,代码来源:ProductListControllerCommon.php

示例4: save

 /**
  * Save user in the database
  */
 public function save($forceOperation = null)
 {
     // auto-generate password if not set
     if (!$this->password->get()) {
         $this->setPassword($this->getAutoGeneratedPassword());
     }
     return parent::save($forceOperation);
 }
开发者ID:saiber,项目名称:www,代码行数:11,代码来源:User.php

示例5: save

 public function save()
 {
     if ($this->isModified()) {
         @unlink($this->userGroup->get()->getRoleCacheFile());
     }
     return parent::save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:AccessControlAssociation.php

示例6: save

 public function save($forceOperation = 0)
 {
     // do not allow 0 rates
     if (!$this->rate->get()) {
         $this->rate->set(1);
     }
     self::deleteCache();
     return parent::save($forceOperation);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:Currency.php

示例7: saveRecord

 protected function saveRecord(ActiveRecordModel $record)
 {
     $record->save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:4,代码来源:MassActionProcessor.php

示例8: save

 public function save($forceOperation = null)
 {
     if (!$this->currency->get()) {
         $this->currency->set($this->realCurrency->get());
         $this->amount->set($this->realAmount->get());
     }
     // encrypt card number
     if ($this->ccLastDigits->isModified()) {
         $this->ccLastDigits->set($this->encrypt($this->ccLastDigits->get()));
     }
     return parent::save($forceOperation);
 }
开发者ID:saiber,项目名称:www,代码行数:12,代码来源:Transaction.php

示例9: save

 public function save()
 {
     BusinessRuleController::clearCache();
     return parent::save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:DiscountConditionRecord.php

示例10: save

 public function save($allowEmpty = false)
 {
     if (!$this->orderedItems) {
         $this->loadItems();
     }
     // remove zero-count items
     foreach ($this->orderedItems as $item) {
         if (!$item->count->get()) {
             $this->removeItem($item);
         }
     }
     $isModified = false;
     foreach ($this->orderedItems as $item) {
         if ($item->isDeleted()) {
             $this->removeItem($item);
         }
     }
     // delete removed items
     if ($this->removedItems) {
         foreach ($this->removedItems as $item) {
             $item->delete();
             $isModified = true;
         }
         $this->removedItems = array();
         $this->resetShipments();
     }
     if ($this->orderedItems) {
         $this->getCurrency();
         foreach ($this->orderedItems as $item) {
             if ($item->isModified()) {
                 if (!$this->isExistingRecord()) {
                     parent::save();
                 }
                 if ($item->save()) {
                     $isModified = true;
                 }
             }
             $item->markAsLoaded();
         }
     }
     // If shipment is modified
     if ($this->isFinalized->get()) {
         if ($this->shipments) {
             foreach ($this->shipments as $shipment) {
                 if ($shipment->isModified()) {
                     $isModified = true;
                     break;
                 }
             }
         }
     }
     if ($isModified) {
         $this->getCurrency();
         // reorder shipments when cart items are modified
         $this->resetShipments();
         $this->totalAmount->set($this->getTotal(true));
     } else {
         if (!$this->isShippingRequired()) {
             //$this->shippingAddress->setNull();
         }
     }
     if ($this->isModified() || $isModified) {
         $this->serializeShipments();
     }
     if (!$this->isFinalized->get() && !$this->orderedItems && !$allowEmpty && !self::$isEmptyAllowed) {
         $this->delete();
         return false;
     }
     if ($this->user->get()) {
         $this->user->get()->invalidateSessionCache();
     }
     return parent::save();
 }
开发者ID:saiber,项目名称:www,代码行数:73,代码来源:CustomerOrder.php

示例11: importAttributes

 protected function importAttributes(ActiveRecordModel $instance, $record, $fields, $attrIdentifier = 'eavField')
 {
     if (isset($fields[$attrIdentifier])) {
         $impReq = new Request();
         $fieldClass = ucfirst($attrIdentifier);
         $valueClass = 'eavField' == $attrIdentifier ? 'EavValue' : $fieldClass . 'Value';
         foreach ($fields[$attrIdentifier] as $specFieldID => $csvIndex) {
             if (empty($record[$csvIndex])) {
                 continue;
             }
             $attr = ActiveRecordModel::getInstanceByID($fieldClass, $specFieldID, ActiveRecord::LOAD_DATA);
             if ($attr->isSimpleNumbers()) {
                 $impReq->set($attr->getFormFieldName(), (double) $record[$csvIndex]);
             } else {
                 if ($attr->isSelector()) {
                     if ($attr->isMultiValue->get()) {
                         $values = explode(',', $record[$csvIndex]);
                     } else {
                         $values = array($record[$csvIndex]);
                     }
                     foreach ($values as $fieldValue) {
                         $fieldValue = trim($fieldValue);
                         $f = new ARSelectFilter(new LikeCond(MultilingualObject::getLangSearchHandle(new ARFieldHandle($valueClass, 'value'), $this->application->getDefaultLanguageCode()), $fieldValue . '%'));
                         $f->setLimit(1);
                         if (!($value = $attr->getRelatedRecordSet($valueClass, $f)->shift())) {
                             $value = call_user_func_array(array($valueClass, 'getNewInstance'), array($attr));
                             if ($attr->type->get() == EavFieldCommon::TYPE_NUMBERS_SELECTOR) {
                                 $value->value->set($fieldValue);
                             } else {
                                 $value->setValueByLang('value', $this->application->getDefaultLanguageCode(), $fieldValue);
                             }
                             $value->save();
                         }
                         if (!$attr->isMultiValue->get()) {
                             $impReq->set($attr->getFormFieldName(), $value->getID());
                         } else {
                             $impReq->set($value->getFormFieldName(), true);
                         }
                     }
                 } else {
                     $impReq->set($attr->getFormFieldName(), $record[$csvIndex]);
                 }
             }
         }
         $instance->loadRequestData($impReq);
         $instance->save();
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:48,代码来源:DataImport.php

示例12: save

 public function save($downloadable = false)
 {
     $this->removeDeletedItems();
     // make sure the shipment doesn't consist of downloadable files only
     if (!$this->isShippable() && !$this->order->get()->isFinalized->get()) {
         //return false;
     }
     // reset amounts...
     //		$this->amount->set(0);
     //		$this->shippingAmount->set(0);
     //		$this->taxAmount->set(0);
     // ... and recalculated them
     $this->recalculateAmounts();
     // set shipping data
     $rate = $this->getSelectedRate();
     if ($rate) {
         $serviceId = $rate->getServiceID();
         if (is_numeric($serviceId)) {
             $this->shippingService->set(ShippingService::getInstanceByID($serviceId));
         } else {
             $this->shippingService->set(null);
             $this->shippingServiceData->set(serialize($rate));
         }
     }
     // Update order status if to reflect it's shipments statuses
     if (!$downloadable && $this->isShippable() && $this->order->get()->isFinalized->get()) {
         $this->order->get()->updateStatusFromShipments(!$this->isExistingRecord());
     }
     parent::save();
     // save ordered items
     foreach ($this->items as $item) {
         if (!$item->isDeleted()) {
             $item->shipment->set($this);
             $item->customerOrder->set($this->order->get());
             $item->save();
         }
     }
     // save taxes
     foreach ($this->getTaxes() as $tax) {
         if ($tax->amount->get()) {
             $tax->save();
         } else {
             $tax->delete();
         }
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:46,代码来源:Shipment.php

示例13: save

 public function save()
 {
     parent::save();
     $this->order->get()->registerFixedDiscount($this);
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:OrderDiscount.php

示例14: save

 public function save($forceOperation = 0)
 {
     self::deleteCache();
     return parent::save($forceOperation);
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:Language.php

示例15: save

 public function save($forceOperation = 0)
 {
     parent::save($forceOperation);
     $this->updateRoles();
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:UserGroup.php


注:本文中的ActiveRecordModel::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。