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


PHP ActiveRecordModel::rollback方法代码示例

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


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

示例1: tearDown

 public function tearDown()
 {
     parent::tearDown();
     @unlink(ClassLoader::getRealPath('cache.') . 'currencies.php');
     $this->setUpCurrency();
     ActiveRecordModel::rollback();
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:LiveCartTest.php

示例2: tearDown

 public function tearDown()
 {
     ActiveRecordModel::rollback();
     foreach ($this->getUsedSchemas() as $table) {
         ActiveRecord::removeClassFromPool($table);
         $this->db->executeUpdate("ALTER TABLE {$table} AUTO_INCREMENT=" . $this->autoincrements[$table]);
     }
     self::getApplication()->setRequest(clone $this->originalRequest);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:UnitTest.php

示例3: deleteByID

 /**
  * Removes a product from a database
  *
  * @param int $recordID
  * @return bool
  * @throws Exception
  */
 public static function deleteByID($recordID)
 {
     ActiveRecordModel::beginTransaction();
     try {
         $product = Product::getInstanceByID($recordID, Product::LOAD_DATA);
         $filter = $product->getCountUpdateFilter(true);
         if ($product->category->get()) {
             $product->updateCategoryCounters($filter, $product->category->get());
         }
         foreach ($product->getAdditionalCategories() as $category) {
             $product->updateCategoryCounters($filter, $category);
         }
         parent::deleteByID(__CLASS__, $recordID);
         ActiveRecordModel::commit();
         return true;
     } catch (Exception $e) {
         ActiveRecordModel::rollback();
         throw $e;
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:Product.php

示例4: delete

 /**
  * Removes category by ID and fixes data in parent categories
  * (updates activeProductCount and totalProductCount)
  *
  * @param int $recordID
  */
 public function delete()
 {
     ActiveRecordModel::beginTransaction();
     try {
         $activeProductCount = $this->activeProductCount->get();
         $totalProductCount = $this->totalProductCount->get();
         $availableProductCount = $this->availableProductCount->get();
         foreach ($this->getPathNodeSet(true) as $node) {
             $node->setFieldValue("activeProductCount", "activeProductCount - " . $activeProductCount);
             $node->setFieldValue("totalProductCount", "totalProductCount - " . $totalProductCount);
             $node->setFieldValue("availableProductCount", "availableProductCount - " . $availableProductCount);
             $node->save();
         }
         ActiveRecordModel::commit();
         parent::delete();
     } catch (Exception $e) {
         ActiveRecordModel::rollback();
         throw $e;
     }
 }
开发者ID:saiber,项目名称:www,代码行数:26,代码来源:Category.php

示例5: test_SuiteTearDown

 function test_SuiteTearDown()
 {
     ActiveRecordModel::rollback();
 }
开发者ID:saiber,项目名称:livecart,代码行数:4,代码来源:ProductTest.php

示例6: postProcessResponse

 protected function postProcessResponse(Response $response)
 {
     if ($response instanceof ActionRedirectResponse) {
         $response = new ActionResponse();
     }
     if (empty($GLOBALS['stepData'])) {
         $stepData = array();
         $stepData['steps'] = $this->getCheckoutSteps($this->order);
         $stepData['editableSteps'] = $this->getStepStatus($this->order);
         $stepData['completedSteps'] = $this->getStepStatus($this->order, true);
         $GLOBALS['stepData'] = $stepData;
     } else {
         $stepData = $GLOBALS['stepData'];
     }
     foreach ($stepData as $key => $data) {
         $response->set($key, $data);
     }
     if ($this->anonTransactionInitiated) {
         ActiveRecordModel::rollback();
     }
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:22,代码来源:OnePageCheckoutController.php

示例7: postProcessResponse

 protected function postProcessResponse(Response $response)
 {
     if ($response instanceof ActionRedirectResponse) {
         $response = new ActionResponse();
     }
     $response->set('steps', $this->getCheckoutSteps($this->order));
     $response->set('editableSteps', $this->getStepStatus($this->order));
     $response->set('completedSteps', $this->getStepStatus($this->order, true));
     if ($this->anonTransactionInitiated) {
         ActiveRecordModel::rollback();
         $this->anonTransactionInitiated = false;
     }
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:OnePageCheckoutController.php

示例8: payCreditCard

 /**
  *	@role login
  */
 public function payCreditCard()
 {
     if ($id = $this->request->get('id')) {
         $this->request->set('order', $id);
     }
     $order = $this->getPaymentOrder();
     if ($redirect = $this->validateOrder($order, self::STEP_PAYMENT)) {
         return $redirect;
     }
     // already paid?
     if ($order->isPaid->get()) {
         return new ActionRedirectResponse('checkout', 'completed');
     }
     ActiveRecordModel::beginTransaction();
     $this->order->setCheckoutStep(CustomerOrder::CHECKOUT_PAY);
     $this->order->setPaymentMethod($this->config->get('CC_HANDLER'));
     // process payment
     $transaction = $this->getTransaction();
     $names = explode(' ', $this->request->get('ccName'), 2);
     $transaction->firstName->set(array_shift($names));
     $transaction->lastName->set(array_shift($names));
     $handler = $this->application->getCreditCardHandler($transaction);
     if ($this->request->isValueSet('ccType')) {
         $handler->setCardType($this->request->get('ccType'));
     }
     $handler->setCardData($this->request->get('ccNum'), $this->request->get('ccExpiryMonth'), $this->request->get('ccExpiryYear'), $this->request->get('ccCVV'));
     if (!$this->buildCreditCardValidator($handler)->isValid()) {
         ActiveRecordModel::rollback();
         return $this->getPaymentPageRedirect();
     }
     if ($this->config->get('CC_AUTHONLY')) {
         $result = $handler->authorize();
     } else {
         $result = $handler->authorizeAndCapture();
     }
     if ($result instanceof TransactionResult) {
         $response = $this->registerPayment($result, $handler);
         $trans = $this->order->getTransactions()->get(0);
         $eavObject = EavObject::getInstance($trans);
         $eavObject->setStringIdentifier('creditcard');
         $eavObject->save();
         $trans->getSpecification()->loadRequestData($this->request);
         $trans->save();
     } elseif ($result instanceof TransactionError) {
         // set error message for credit card form
         $validator = $this->buildCreditCardValidator($handler);
         $validator->triggerError('creditCardError', $this->translate('_err_processing_cc'));
         $validator->saveState();
         $response = $this->getPaymentPageRedirect();
     } else {
         var_dump($result);
         throw new Exception('Unknown transaction result type: ' . get_class($result));
     }
     ActiveRecordModel::commit();
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:59,代码来源:CheckoutController.php

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