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


PHP ActiveRecordModel::delete方法代码示例

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


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

示例1: delete

 public function delete()
 {
     if (ActiveRecordModel::getApplication()->getConfig()->get('CLONE_STORE_TYPE') == 'CLONE_STORE_MASTER') {
         return parent::delete();
     } else {
         ActiveRecordModel::executeUpdate('SET FOREIGN_KEY_CHECKS=0');
         ActiveRecordModel::executeUpdate('UPDATE ' . __CLASS__ . ' SET productID=NULL, variationID=NULL, protectedFields="|productID||variationID|" WHERE ID=' . $this->getID());
     }
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:ProductVariationValue.php

示例2: delete

 public function delete()
 {
     parent::delete();
     $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);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:ProductRating.php

示例3: delete

 /**
  * Removes a product review from a database
  */
 public function delete()
 {
     // reduce product review count
     $this->updateProductCounter(false);
     // update ratings
     foreach ($this->getRelatedRecordSet('ProductRating') as $rating) {
         $rating->delete();
     }
     return parent::delete();
 }
开发者ID:saiber,项目名称:www,代码行数:13,代码来源:ProductReview.php

示例4: deleteRecord

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

示例5: delete

 public function delete()
 {
     $this->product->get()->updateCategoryCounters($this->product->get()->getCountUpdateFilter(true), $this->category->get());
     parent::delete();
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:ProductCategory.php

示例6: delete

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

示例7: delete

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

示例8: delete

 /**
  * Delete this node with subtree
  *
  * @return bool
  *
  * @throws Exception If failed to commit the transaction
  */
 public function delete()
 {
     $className = get_class($this);
     $this->load();
     $t_r = $this->getFieldValue(self::RIGHT_NODE_FIELD_NAME);
     $t_l = $this->getFieldValue(self::LEFT_NODE_FIELD_NAME);
     $width = $this->getWidth();
     ActiveRecordModel::beginTransaction();
     try {
         $updates[] = "UPDATE {$className} SET " . self::RIGHT_NODE_FIELD_NAME . " = " . self::RIGHT_NODE_FIELD_NAME . " - {$width}  WHERE " . self::RIGHT_NODE_FIELD_NAME . " >= {$t_r}";
         $updates[] = "UPDATE {$className} SET " . self::LEFT_NODE_FIELD_NAME . " = " . self::LEFT_NODE_FIELD_NAME . " - {$width} WHERE " . self::LEFT_NODE_FIELD_NAME . " >= {$t_l}";
         foreach ($updates as $update) {
             self::getLogger()->logQuery($update);
             self::getDBConnection()->executeUpdate($update);
         }
         $result = parent::delete();
         ActiveRecordModel::commit();
         foreach (ActiveRecord::retrieveFromPool(get_class($this)) as $instance) {
             if ($instance->getFieldValue(self::RIGHT_NODE_FIELD_NAME) >= $t_r) {
                 $instance->setFieldValue(self::RIGHT_NODE_FIELD_NAME, $instance->getFieldValue(self::RIGHT_NODE_FIELD_NAME) - $width);
             }
             if ($instance->getFieldValue(self::LEFT_NODE_FIELD_NAME) >= $t_l) {
                 $instance->setFieldValue(self::LEFT_NODE_FIELD_NAME, $instance->getFieldValue(self::LEFT_NODE_FIELD_NAME) - $width);
             }
         }
     } catch (Exception $e) {
         ActiveRecordModel::rollback();
         throw $e;
     }
     $this->setID(false);
     $this->markAsNotLoaded();
     return $result;
 }
开发者ID:saiber,项目名称:www,代码行数:40,代码来源:ActiveTreeNode.php


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