/** * Test * * @return void */ public function testDelete() { $this->object->setTabs(array(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 2, 'document_type_id' => $this->documentType->getId()))); $this->object->save(); $this->assertTrue($this->object->delete()); }
/** * Delete document type model * * @return boolean */ 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; }