Removed useless transactions

This commit is contained in:
Franck Allimant
2014-05-02 18:23:04 +02:00
parent 7996c866d3
commit 3b7589ec84

View File

@@ -64,7 +64,8 @@ class Coupon extends BaseCoupon
*/ */
public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null) public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
{ {
$this->setCode($code) $this
->setCode($code)
->setType($type) ->setType($type)
->setEffects($effects) ->setEffects($effects)
->setIsRemovingPostage($isRemovingPostage) ->setIsRemovingPostage($isRemovingPostage)
@@ -72,8 +73,9 @@ class Coupon extends BaseCoupon
->setExpirationDate($expirationDate) ->setExpirationDate($expirationDate)
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers) ->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
->setIsCumulative($isCumulative) ->setIsCumulative($isCumulative)
->setMaxUsage($maxUsage); ->setMaxUsage($maxUsage)
$this->setTitle($title) ->setLocale($locale)
->setTitle($title)
->setShortDescription($shortDescription) ->setShortDescription($shortDescription)
->setDescription($description); ->setDescription($description);
@@ -82,21 +84,7 @@ class Coupon extends BaseCoupon
$this->setSerializedConditions($defaultSerializedRule); $this->setSerializedConditions($defaultSerializedRule);
} }
// Set object language (i18n) $this->save();
if (!is_null($locale)) {
$this->setLocale($locale);
}
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
$this->save($con);
$con->commit();
} catch (\Exception $e) {
$con->rollback();
throw $e;
}
} }
/** /**
@@ -116,15 +104,7 @@ class Coupon extends BaseCoupon
$this->setLocale($locale); $this->setLocale($locale);
} }
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME); $this->save();
$con->beginTransaction();
try {
$this->save($con);
$con->commit();
} catch (\Exception $e) {
$con->rollback();
throw $e;
}
} }
/** /**