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


PHP ConnectionInterface::rollback方法代码示例

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


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

示例1: createNumber

 /**
  * @throws \Spryker\Zed\SequenceNumber\Business\Exception\InvalidSequenceNumberException
  *
  * @return int
  */
 protected function createNumber()
 {
     try {
         $this->connection->beginTransaction();
         $sequence = $this->getSequence();
         $idCurrent = $sequence->getCurrentId() + $this->randomNumberGenerator->generate();
         $sequence->setCurrentId($idCurrent);
         $sequence->save();
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->connection->rollback();
         throw new InvalidSequenceNumberException('Could not generate sequence number. Make sure your settings are complete. Error: ' . $e->getMessage());
     }
     return $idCurrent;
 }
开发者ID:spryker,项目名称:SequenceNumber,代码行数:20,代码来源:SequenceNumber.php

示例2: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     $this->con->exec("SET FOREIGN_KEY_CHECKS = 1;");
     $this->con->rollback();
 }
开发者ID:Alban-io,项目名称:TheliaStudio,代码行数:6,代码来源:RuleGeneratorTest.php

示例3: importJsonPrice

 public static function importJsonPrice(SocolissimoDeliveryMode $deliveryMode, ConnectionInterface $con)
 {
     $areaPrices = self::getPrices($deliveryMode);
     $priceExist = SocolissimoPriceQuery::create()->filterByDeliveryModeId($deliveryMode->getId())->findOne();
     //If at least one price exist doesn't import the xml (or it will erase the user price)
     if (null !== $priceExist) {
         return;
     }
     $con->beginTransaction();
     try {
         foreach ($areaPrices as $areaId => $area) {
             foreach ($area['slices'] as $weight => $price) {
                 $slice = (new SocolissimoPrice())->setAreaId($areaId)->setWeightMax($weight)->setPrice($price)->setDeliveryModeId($deliveryMode->getId());
                 $slice->save();
             }
             $con->commit();
         }
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:bcbrr,项目名称:SoColissimo,代码行数:22,代码来源:SoColissimo.php


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