public function deleteTemplateById($templateId)
{
if (!$templateId) {
return false;
}
$transaction = craft()->db->getCurrentTransaction() === null ? craft()->db->beginTransaction() : null;
try {
$record = FormBuilder2_TemplateRecord::model()->findById(array('id' => $templateId));
$affectedRows = craft()->db->createCommand()->delete('formbuilder2_templates', array('id' => $templateId));
if ($transaction !== null) {
$transaction->commit();
}
return (bool) $affectedRows;
} catch (\Exception $e) {
if ($transaction !== null) {
$transaction->rollback();
}
throw $e;
}
}