public function delete()
{
$this->events()->trigger(__CLASS__, 'before.delete', $this);
$documentId = $this->getId();
if (!empty($documentId)) {
try {
$propertiesTable = new TableGateway('property_value', $this->getAdapter());
$propertiesTable->delete(array('document_id' => $this->getId()));
parent::delete(array('id' => $documentId));
} catch (\Exception $e) {
throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
}
$this->events()->trigger(__CLASS__, 'after.delete', $this);
unset($this);
return true;
}
$this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
return false;
}