Exemple #1
0
 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());
     }
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 /**
  * 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();
 }
 protected function deleteRecord(ActiveRecordModel $record)
 {
     $record->delete();
 }
Exemple #5
0
 public function delete()
 {
     $this->product->get()->updateCategoryCounters($this->product->get()->getCountUpdateFilter(true), $this->category->get());
     parent::delete();
 }
 public function delete()
 {
     parent::delete();
     $this->updateConditionRecordCount(false);
 }
Exemple #7
0
 public function delete()
 {
     $order = $this->order->get();
     $order->removeShipment($this);
     parent::delete();
     $order->save();
 }
Exemple #8
0
 /**
  * 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;
 }