src/Alchemy/Component/Cerberus/Model/Base/Role.php
public function removePermission(ChildPermission $permission)
    {
        if ($this->getPermissions()->contains($permission)) { $rolePermission = new ChildRolePermission();

            $rolePermission->setPermission($permission);
            if ($permission->isRolesLoaded()) {
                //remove the back reference if available
                $permission->getRoles()->removeObject($this);
            }

            $rolePermission->setRole($this);
            $this->removeRolePermission(clone $rolePermission);
            $rolePermission->clear();

            $this->collPermissions->remove($this->collPermissions->search($permission));

            if (null === $this->permissionsScheduledForDeletion) {
                $this->permissionsScheduledForDeletion = clone $this->collPermissions;
                $this->permissionsScheduledForDeletion->clear();
            }

            $this->permissionsScheduledForDeletion->push($permission);
        }


        return $this;
    }
public function removePermission(ChildPermission $permission)
    {
        if ($this->getPermissions()->contains($permission)) { $rolePermission = new ChildRolePermission();

            $rolePermission->setPermission($permission);
            if ($permission->isRolesLoaded()) {
                //remove the back reference if available
                $permission->getRoles()->removeObject($this);
            }

            $rolePermission->setRole($this);
            $this->removeRolePermission(clone $rolePermission);
            $rolePermission->clear();

            $this->collPermissions->remove($this->collPermissions->search($permission));

            if (null === $this->permissionsScheduledForDeletion) {
                $this->permissionsScheduledForDeletion = clone $this->collPermissions;
                $this->permissionsScheduledForDeletion->clear();
            }

            $this->permissionsScheduledForDeletion->push($permission);
        }


        return $this;
    }
public function removePermission ( ChildPermission $ permission ) { if ( $ this -> getPermissions ( ) -> contains ( $ permission ) ) { $ rolePermission = new ChildRolePermission ( ) ; $ rolePermission -> setPermission ( $ permission ) ; if ( $ permission -> isRolesLoaded ( ) ) { //remove the back reference if available $ permission -> getRoles ( ) -> removeObject ( $ this ) ; } $ rolePermission -> setRole ( $ this ) ; $ this -> removeRolePermission ( clone $ rolePermission ) ; $ rolePermission -> clear ( ) ; $ this -> collPermissions -> remove ( $ this -> collPermissions -> search ( $ permission ) ) ; if ( null === $ this -> permissionsScheduledForDeletion ) { $ this -> permissionsScheduledForDeletion = clone $ this -> collPermissions ; $ this -> permissionsScheduledForDeletion -> clear ( ) ; } $ this -> permissionsScheduledForDeletion -> push ( $ permission ) ; } return $ this ; }
Remove permission of this object
through the role_permission cross reference table.

@param ChildPermission $permission
@return ChildRole The current object (for fluent API support)
Remove permission of this object through the role_permission cross reference table .