delete() public method

Delete tabs
public delete ( ) : boolean
return boolean
Example #1
0
 /**
  * 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());
 }
Example #2
0
 /**
  * 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;
 }