Gc\User\Model::delete PHP Method

delete() public method

Delete user
public delete ( ) : boolean
return boolean
    public function delete()
    {
        $this->events()->trigger(__CLASS__, 'before.delete', $this);
        $id = $this->getId();
        if (!empty($id)) {
            try {
                parent::delete(array('id' => $id));
            } 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;
    }

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()
 {
     unset($this->object);
     $this->documentType->delete();
     unset($this->documentType);
     $this->view->delete();
     unset($this->view);
     $this->layout->delete();
     unset($this->layout);
     $this->user->delete();
     unset($this->user);
 }
All Usage Examples Of Gc\User\Model::delete