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


PHP ActiveRecordModel::insert方法代码示例

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


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

示例1: insert

 protected function insert()
 {
     $this->product->get()->updateCategoryCounters($this->product->get()->getCountUpdateFilter(), $this->category->get());
     $this->product->get()->registerAdditionalCategory($this->category->get());
     $insertResult = parent::insert();
     Category::updateCategoryIntervals($this->product->get());
     return $insertResult;
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:ProductCategory.php

示例2: insert

 protected function insert()
 {
     $str = '';
     for ($k = 0; $k < 20; $k++) {
         $str .= chr(rand(0, 255));
     }
     $this->confirmationCode->set(substr(md5($str), 0, 12));
     return parent::insert();
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:NewsletterSubscriber.php

示例3: insert

 protected function insert()
 {
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('SearchLog', 'keywords'), $this->keywords->get()));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('SearchLog', 'ip'), $this->ip->get()));
     if (!ActiveRecordModel::getRecordCount(__CLASS__, $f)) {
         parent::insert();
         $update = new ARUpdateFilter();
         $update->addModifier('time', new ARExpressionHandle('NOW()'));
         $update->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'ID'), $this->getID()));
         ActiveRecordModel::updateRecordSet(__CLASS__, $update);
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:12,代码来源:SearchLog.php

示例4: insert

 protected function insert()
 {
     self::beginTransaction();
     $this->dateCreated->set(new ARSerializableDateTime());
     parent::insert();
     $summary = ProductRatingSummary::getInstance($this->product->get(), $this->ratingType->get());
     $summary->save();
     $f = new ARUpdateFilter();
     $f->addModifier('ratingSum', new ARExpressionHandle('ratingSum+' . $this->rating->get()));
     $f->addModifier('ratingCount', new ARExpressionHandle('ratingCount+1'));
     $f->addModifier('rating', new ARExpressionHandle('ratingSum/ratingCount'));
     $this->updateRatings($f);
     self::commit();
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:ProductRating.php

示例5: insert

 protected function insert()
 {
     $res = parent::insert();
     if ($subscriber = NewsletterSubscriber::getInstanceByEmail($this->email->get())) {
         $subscriber->user->set($this);
     } else {
         $subscriber = NewsletterSubscriber::getNewInstanceByUser($this);
         $subscriber->isEnabled->set(false);
         $subscriber->save();
     }
     $subscriber->confirmationCode->set('');
     $subscriber->save();
     return $res;
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:User.php

示例6: insert

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

示例7: insert

 protected function insert()
 {
     if (self::TYPE_CAPTURE == $this->type->get() || self::TYPE_SALE == $this->type->get()) {
         $this->order->get()->addCapturedAmount($this->amount->get());
     } else {
         if (self::TYPE_VOID == $this->type->get()) {
             $parentType = $this->parentTransaction->get()->type->get();
             if (self::TYPE_CAPTURE == $parentType || self::TYPE_SALE == $parentType) {
                 $this->order->get()->addCapturedAmount(-1 * $this->parentTransaction->get()->amount->get());
             }
         }
     }
     $this->order->get()->save();
     if ($this->handler instanceof CreditCardPayment) {
         $this->setAsCreditCard();
         $this->ccExpiryMonth->set($this->handler->getExpirationMonth());
         $this->ccExpiryYear->set($this->handler->getExpirationYear());
         $this->ccType->set($this->handler->getCardType());
         $this->ccName->set($this->handler->getDetails()->getName());
         $this->ccLastDigits->set($this->handler->getCardNumber());
         // only the last 5 digits of credit card number are normally stored
         if (!$this->handler->isCardNumberStored()) {
             $this->truncateCcNumber();
         } else {
             $this->ccCVV->set(self::encrypt($this->handler->getCardCode()));
         }
         $this->ccLastDigits->set(self::encrypt($this->ccLastDigits->get()));
     }
     if ($this->handler) {
         $this->method->set(get_class($this->handler));
     }
     return parent::insert();
 }
开发者ID:saiber,项目名称:www,代码行数:33,代码来源:Transaction.php

示例8: insert

 protected function insert()
 {
     $this->deleteInstancesByOrder($this->order->get());
     return parent::insert();
 }
开发者ID:saiber,项目名称:www,代码行数:5,代码来源:ExpressCheckout.php

示例9: insert

 protected function insert()
 {
     parent::insert();
     $this->updateConditionRecordCount();
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:DiscountConditionRecord.php

示例10: insert

 protected function insert()
 {
     $this->setLastPosition('category');
     return parent::insert();
 }
开发者ID:saiber,项目名称:www,代码行数:5,代码来源:CategoryRelationship.php

示例11: insert

 protected function insert()
 {
     $this->updateProductCounter();
     $this->dateCreated->set(new ARSerializableDateTime());
     return parent::insert();
 }
开发者ID:saiber,项目名称:www,代码行数:6,代码来源:ProductReview.php

示例12: insert

 protected function insert()
 {
     $this->setLastPosition();
     parent::insert();
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:Language.php

示例13: insert

 protected function insert()
 {
     if (!$this->shipment->get()->isExistingRecord()) {
         return false;
     }
     return parent::insert();
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:ShipmentTax.php

示例14: insert

 protected function insert()
 {
     // the shipment objects are often restored from serialized state, so we must mark all fields as modified
     foreach ($this->data as $field) {
         if (!$field->isNull()) {
             $field->setAsModified();
         }
     }
     // Save updated order status
     if ($this->order->get()->isFinalized->get()) {
         $this->order->get()->save();
     }
     if (!$this->status->get()) {
         $this->status->set(self::STATUS_NEW);
     }
     return parent::insert();
 }
开发者ID:saiber,项目名称:livecart,代码行数:17,代码来源:Shipment.php

示例15: insert

 protected function insert()
 {
     $this->updatePriceDiff();
     return parent::insert();
 }
开发者ID:GregerA,项目名称:livecart,代码行数:5,代码来源:OrderedItemOption.php


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