Commit e9ad7d6e by resurtm

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

parent d2f35f20
...@@ -66,7 +66,7 @@ use yii\caching\Cache; ...@@ -66,7 +66,7 @@ use yii\caching\Cache;
* // ... executing other SQL statements ... * // ... executing other SQL statements ...
* $transaction->commit(); * $transaction->commit();
* } catch(Exception $e) { * } catch(Exception $e) {
* $transaction->rollBack(); * $transaction->rollback();
* } * }
* ~~~ * ~~~
* *
......
...@@ -64,14 +64,14 @@ class Migration extends \yii\base\Component ...@@ -64,14 +64,14 @@ class Migration extends \yii\base\Component
$transaction = $this->db->beginTransaction(); $transaction = $this->db->beginTransaction();
try { try {
if ($this->safeUp() === false) { if ($this->safeUp() === false) {
$transaction->rollBack(); $transaction->rollback();
return false; return false;
} }
$transaction->commit(); $transaction->commit();
} catch (\Exception $e) { } catch (\Exception $e) {
echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n"; echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
echo $e->getTraceAsString() . "\n"; echo $e->getTraceAsString() . "\n";
$transaction->rollBack(); $transaction->rollback();
return false; return false;
} }
return null; return null;
...@@ -89,14 +89,14 @@ class Migration extends \yii\base\Component ...@@ -89,14 +89,14 @@ class Migration extends \yii\base\Component
$transaction = $this->db->beginTransaction(); $transaction = $this->db->beginTransaction();
try { try {
if ($this->safeDown() === false) { if ($this->safeDown() === false) {
$transaction->rollBack(); $transaction->rollback();
return false; return false;
} }
$transaction->commit(); $transaction->commit();
} catch (\Exception $e) { } catch (\Exception $e) {
echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n"; echo "Exception: " . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
echo $e->getTraceAsString() . "\n"; echo $e->getTraceAsString() . "\n";
$transaction->rollBack(); $transaction->rollback();
return false; return false;
} }
return null; return null;
......
...@@ -25,7 +25,7 @@ use yii\base\InvalidConfigException; ...@@ -25,7 +25,7 @@ use yii\base\InvalidConfigException;
* //.... other SQL executions * //.... other SQL executions
* $transaction->commit(); * $transaction->commit();
* } catch(Exception $e) { * } catch(Exception $e) {
* $transaction->rollBack(); * $transaction->rollback();
* } * }
* ~~~ * ~~~
* *
...@@ -42,14 +42,14 @@ class Transaction extends \yii\base\Object ...@@ -42,14 +42,14 @@ class Transaction extends \yii\base\Object
public $db; public $db;
/** /**
* @var boolean whether this transaction is active. Only an active transaction * @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; private $_active = false;
/** /**
* Returns a value indicating whether this transaction is active. * Returns a value indicating whether this transaction is active.
* @return boolean whether this transaction is active. Only an active transaction * @return boolean whether this transaction is active. Only an active transaction
* can [[commit()]] or [[rollBack()]]. * can [[commit()]] or [[rollback()]].
*/ */
public function getIsActive() public function getIsActive()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment