public function delete()
{
// perform this process in a transaction if one has not been created
$transaction = Yii::app()->db->getCurrentTransaction() === null ? Yii::app()->db->beginTransaction() : false;
try {
if (parent::delete()) {
if ($transaction) {
$transaction->commit();
}
return true;
} else {
if ($transaction) {
$transaction->rollback();
}
return false;
}
} catch (Exception $e) {
if ($transaction) {
$transaction->rollback();
}
throw $e;
}
}