Использование транзакций


Транзакции

$transaction=$connection->beginTransaction();
try
{
    $connection->createCommand($sql1)->execute();
    $connection->createCommand($sql2)->execute();
    $transaction->commit();
}
catch(Exception $e) 
{
    $transaction->rollback();
}