public function delete()
{
$this->events()->trigger(__CLASS__, 'before.delete', $this);
$documentTypeId = $this->getId();
if (!empty($documentTypeId)) {
$tabCollection = new Tab\Collection();
$tabCollection->load($documentTypeId);
$tabCollection->delete();
$table = new TableGateway('document_type_view', $this->getAdapter());
$table->delete(array('document_type_id' => (int) $documentTypeId));
parent::delete(array('id' => $documentTypeId));
$this->events()->trigger(__CLASS__, 'after.delete', $this);
unset($this);
return true;
}
$this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
return false;
}