delete() public method

Delete properties
public delete ( ) : boolean
return boolean
Beispiel #1
0
 /**
  * Delete tab
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $tabId = $this->getId();
     if (!empty($tabId)) {
         try {
             $propertiesCollection = new Property\Collection();
             $propertiesCollection->load(null, $tabId);
             $propertiesCollection->delete();
             parent::delete(array('id' => $tabId));
         } 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;
 }
Beispiel #2
0
 /**
  * Test
  *
  * @return void
  */
 public function testDelete()
 {
     $this->object->setProperties(array($this->property->getData()));
     $this->assertTrue($this->object->delete());
 }