Gc\Property\Collection::delete PHP Method

delete() public method

Delete properties
public delete ( ) : boolean
return boolean
    public function delete()
    {
        $properties = $this->getProperties();
        try {
            foreach ($properties as $property) {
                $property->delete();
            }
            return true;
        } catch (\Exception $e) {
            throw new \Gc\Exception($e->getMessage());
        }
    }

Usage Example

Ejemplo n.º 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;
 }
All Usage Examples Of Gc\Property\Collection::delete