setEntityClass() public method

public setEntityClass ( $entityClass )
 /**
  * Sets the permissions for the object with the given class and id for the given security identity.
  *
  * @param string $type The name of the class to protect
  * @param string $identifier
  * @param $permissions
  */
 public function setPermissions($type, $identifier, $permissions)
 {
     foreach ($permissions as $roleId => $rolePermissions) {
         $accessControl = $this->accessControlRepository->findByTypeAndIdAndRole($type, $identifier, $roleId);
         if ($accessControl) {
             $accessControl->setPermissions($this->maskConverter->convertPermissionsToNumber($rolePermissions));
         } else {
             $role = $this->roleRepository->findRoleById($roleId);
             $accessControl = new AccessControl();
             $accessControl->setPermissions($this->maskConverter->convertPermissionsToNumber($rolePermissions));
             $accessControl->setRole($role);
             $accessControl->setEntityId($identifier);
             $accessControl->setEntityClass($type);
             $this->objectManager->persist($accessControl);
         }
     }
     $this->objectManager->flush();
 }
 public function testSetPermissions()
 {
     $role1 = new Role();
     $role2 = new Role();
     $this->roleRepository->findRoleById(1)->willReturn($role1);
     $this->roleRepository->findRoleById(2)->willReturn($role2);
     $this->maskConverter->convertPermissionsToNumber(['view' => true, 'edit' => false])->willReturn(64);
     $this->maskConverter->convertPermissionsToNumber(['view' => true, 'edit' => true])->willReturn(96);
     $accessControl1 = new AccessControl();
     $accessControl1->setEntityClass('AcmeBundle\\Example');
     $accessControl1->setEntityId(1);
     $accessControl1->setPermissions(64);
     $accessControl1->setRole($role1);
     $accessControl2 = new AccessControl();
     $accessControl2->setEntityClass('AcmeBundle\\Example');
     $accessControl2->setEntityId(1);
     $accessControl2->setPermissions(96);
     $accessControl2->setRole($role2);
     $this->objectManager->persist($accessControl1)->shouldBeCalled();
     $this->objectManager->persist($accessControl2)->shouldBeCalled();
     $this->objectManager->flush()->shouldBeCalled();
     $this->doctrineAccessControlProvider->setPermissions('AcmeBundle\\Example', 1, [1 => ['view' => true, 'edit' => false], 2 => ['view' => true, 'edit' => true]]);
 }