예제 #1
0
 public function action_changeShort()
 {
     echo 'test2';
     return;
     $member = \MemberQuery::create()->findOneById(1);
     $con = \Propel::getConnection();
     if (!$con->beginTransaction()) {
         throw new \Exception('Could not begin transaction');
     }
     try {
         $transfer = \TransferQuery::create()->findOneById(1);
         if (!$transfer) {
             $transfer = new \Transfer();
             $transfer->setMemberId($member->getId());
             $transfer->save($con);
             $transfer = \TransferQuery::create()->findOneById(1);
         }
         $transfer->setAmount($transfer->getAmount() + 2);
         $transfer->save($con);
         if (!$con->commit()) {
             throw new \Exception('Could not commit transaction');
         }
     } catch (\Exception $e) {
         $con->rollBack();
         throw $e;
     }
     print_r('<pre>');
     print_r($transfer->toArray());
     print_r('</pre>');
 }
예제 #2
0
<?php

echo 'test1';
include dirname(__FILE__) . '/bootstrap.php';
$member = \MemberQuery::create()->findOneById(1);
$con = \Propel::getConnection();
if (!$con->beginTransaction()) {
    throw new \Exception('Could not begin transaction');
}
try {
    $transfer = \TransferQuery::create()->findOneById(1);
    if (!$transfer) {
        $transfer = new \Transfer();
        $transfer->setMemberId($member->getId());
        $transfer->save($con);
        $transfer = \TransferQuery::create()->findOneById(1);
    }
    $transfer->setAmount($transfer->getAmount() + 2);
    $transfer->save($con);
    if (!$con->commit()) {
        throw new \Exception('Could not commit transaction');
    }
} catch (\Exception $e) {
    $con->rollBack();
    throw $e;
}
print_r('<pre>');
print_r($transfer->toArray());
print_r('</pre>');
echo "\n CONSISTENCY 2\n";