Browse Source

Rollback word consistencty over entire codebase (ref. #139).

tags/2.0.0-beta
resurtm 12 years ago
parent
commit
e9ad7d6e36
  1. 2
      framework/db/Connection.php
  2. 8
      framework/db/Migration.php
  3. 6
      framework/db/Transaction.php

2
framework/db/Connection.php

@ -66,7 +66,7 @@ use yii\caching\Cache;
* // ... executing other SQL statements ...
* $transaction->commit();
* } catch(Exception $e) {
* $transaction->rollBack();
* $transaction->rollback();
* }
* ~~~
*

8
framework/db/Migration.php

@ -64,14 +64,14 @@ class Migration extends \yii\base\Component
$transaction = $this->db->beginTransaction();
try {
if ($this->safeUp() === false) {
$transaction->rollBack();
$transaction->rollback();
return false;
}
$transaction->commit();
} catch (\Exception $e) {
echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
echo $e->getTraceAsString() . "\n";
$transaction->rollBack();
$transaction->rollback();
return false;
}
return null;
@ -89,14 +89,14 @@ class Migration extends \yii\base\Component
$transaction = $this->db->beginTransaction();
try {
if ($this->safeDown() === false) {
$transaction->rollBack();
$transaction->rollback();
return false;
}
$transaction->commit();
} catch (\Exception $e) {
echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
echo $e->getTraceAsString() . "\n";
$transaction->rollBack();
$transaction->rollback();
return false;
}
return null;

6
framework/db/Transaction.php

@ -25,7 +25,7 @@ use yii\base\InvalidConfigException;
* //.... other SQL executions
* $transaction->commit();
* } catch(Exception $e) {
* $transaction->rollBack();
* $transaction->rollback();
* }
* ~~~
*
@ -42,14 +42,14 @@ class Transaction extends \yii\base\Object
public $db;
/**
* @var boolean whether this transaction is active. Only an active transaction
* can [[commit()]] or [[rollBack()]]. This property is set true when the transaction is started.
* can [[commit()]] or [[rollback()]]. This property is set true when the transaction is started.
*/
private $_active = false;
/**
* Returns a value indicating whether this transaction is active.
* @return boolean whether this transaction is active. Only an active transaction
* can [[commit()]] or [[rollBack()]].
* can [[commit()]] or [[rollback()]].
*/
public function getIsActive()
{

Loading…
Cancel
Save