Gc\DocumentType\Model::delete PHP Method

delete() public method

Delete document type model
public delete ( ) : boolean
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;
    }

Usage Example

Example #1
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 protected function tearDown()
 {
     $this->object->delete();
     $this->documentType->delete();
     $this->user->delete();
     $this->layout->delete();
     $this->view->delete();
     unset($this->documentType);
     unset($this->user);
     unset($this->layout);
     unset($this->view);
     unset($this->object);
 }
All Usage Examples Of Gc\DocumentType\Model::delete