Gc\User\Role\Model::delete PHP Method

delete() public method

Delete Role
public delete ( ) : boolean
return boolean
    public function delete()
    {
        $this->events()->trigger(__CLASS__, 'before.delete', $this);
        $id = $this->getId();
        if (!empty($id)) {
            parent::delete(array('id' => $id));
            $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
 /**
  * Test
  *
  * @return void
  */
 public function testFakeDelete()
 {
     $model = new Model();
     $this->assertFalse($model->delete());
 }