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


PHP oxDb::commitTransaction方法代码示例

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


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

示例1: recalculateOrder

 /**
  * Recalculates order. Starts transactions, deletes current order and order articles from DB,
  * adds current order articles to virtual basket and finaly recalculates order by calling oxorder::finalizeOrder()
  * If no errors, finishing transaction.
  *
  * @param array $aNewArticles article list of new order
  *
  * @return null
  */
 public function recalculateOrder($aNewArticles = array())
 {
     oxDb::startTransaction();
     try {
         $oBasket = $this->_getOrderBasket();
         // add this order articles to virtual basket and recalculates basket
         $this->_addOrderArticlesToBasket($oBasket, $this->getOrderArticles(true));
         // adding new articles to existing order
         $this->_addArticlesToBasket($oBasket, $aNewArticles);
         // recalculating basket
         $oBasket->calculateBasket(true);
         //finalizing order (skipping payment execution, vouchers marking and mail sending)
         $iRet = $this->finalizeOrder($oBasket, $this->getOrderUser(), true);
         //if finalizing order failed, rollback transaction
         if ($iRet !== 1) {
             oxDb::rollbackTransaction();
         } else {
             oxDb::commitTransaction();
         }
     } catch (Exception $oE) {
         // if exception, rollBack everything
         oxDb::rollbackTransaction();
         if (defined('OXID_PHP_UNIT')) {
             throw $oE;
         }
     }
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:36,代码来源:oxorder.php

示例2: _addNewMultilangFieldsToDb

 /**
  * Adding new language to DB - creating new multilangue fields with new
  * language ID (e.g. oxtitle_4)
  *
  * @return null
  */
 protected function _addNewMultilangFieldsToDb()
 {
     //creating new multilanguage fields with new id over whole DB
     oxDb::startTransaction();
     $oDbMeta = oxNew("oxDbMetaDataHandler");
     try {
         $oDbMeta->addNewLangToDb();
     } catch (Exception $oEx) {
         // if exception, rollBack everything
         oxDb::rollbackTransaction();
         //show warning
         echo $oEx->getMessage();
         $oEx = oxNew("oxExceptionToDisplay");
         $oEx->setMessage('LANGUAGE_ERROR_ADDING_MULTILANG_FIELDS');
         oxUtilsView::getInstance()->addErrorToDisplay($oEx);
         return;
     }
     oxDb::commitTransaction();
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:25,代码来源:language_main.php

示例3: _resetMultiLangDbFields

 /**
  * Resets all multilanguage fields with specific language id
  * to default value in all tables.
  *
  * @param string $iLangId language ID
  *
  * @return null
  */
 protected function _resetMultiLangDbFields($iLangId)
 {
     $iLangId = (int) $iLangId;
     //skipping reseting language with id = 0
     if ($iLangId) {
         oxDb::startTransaction();
         try {
             $oDbMeta = oxNew("oxDbMetaDataHandler");
             $oDbMeta->resetLanguage($iLangId);
             oxDb::commitTransaction();
         } catch (Exception $oEx) {
             // if exception, rollBack everything
             oxDb::rollbackTransaction();
             //show warning
             $oEx = oxNew("oxExceptionToDisplay");
             $oEx->setMessage('LANGUAGE_ERROR_RESETING_MULTILANG_FIELDS');
             oxUtilsView::getInstance()->addErrorToDisplay($oEx);
         }
     }
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:28,代码来源:language_list.php


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