Sulu\Component\Security\Authentication\RoleRepositoryInterface::findRoleById PHP Méthode

findRoleById() public méthode

Finds a role with a specific id.
public findRoleById ( integer $id ) : Sulu\Component\Security\Authentication\RoleInterface
$id integer id of the role
Résultat Sulu\Component\Security\Authentication\RoleInterface
    public function findRoleById($id);

Usage Example

 public function testSetPermissionsWithExistingAccessControl()
 {
     $role = new Role();
     $this->roleRepository->findRoleById(1)->willReturn($role);
     $this->maskConverter->convertPermissionsToNumber(['view' => true, 'edit' => false])->willReturn(64);
     $accessControl = $this->prophesize(AccessControl::class);
     $accessControl->setPermissions(64)->shouldBeCalled();
     $this->accessControlRepository->findByTypeAndIdAndRole('AcmeBundle\\Example', 1, 1)->willReturn($accessControl);
     $this->objectManager->persist(Argument::any())->shouldNotBeCalled();
     $this->objectManager->flush()->shouldBeCalled();
     $this->doctrineAccessControlProvider->setPermissions('AcmeBundle\\Example', 1, [1 => ['view' => true, 'edit' => false]]);
 }
All Usage Examples Of Sulu\Component\Security\Authentication\RoleRepositoryInterface::findRoleById