public function deleteBlockType(Neo_BlockTypeModel $blockType)
{
$transaction = $this->beginTransaction();
try {
// First delete the blocks of this type
$blockIds = craft()->db->createCommand()->select('id')->from('neoblocks')->where(['typeId' => $blockType->id])->queryColumn();
$this->deleteBlockById($blockIds);
// Delete the field layout
craft()->fields->deleteLayoutById($blockType->fieldLayoutId);
// Finally delete the actual block type
$affectedRows = craft()->db->createCommand()->delete('neoblocktypes', ['id' => $blockType->id]);
$this->commitTransaction($transaction);
return (bool) $affectedRows;
} catch (\Exception $e) {
$this->rollbackTransaction($transaction);
throw $e;
}
}