/**
  * Constructor.
  */
 public function __construct(WorkspaceRegistrationQueue $queue)
 {
     $this->user = $queue->getUser();
     $this->workspace = $queue->getWorkspace();
     $this->role = $queue->getRole();
     $details = array('role' => array('name' => $this->role->getTranslationKey()));
     $details['workspace'] = array('name' => $this->workspace->getName(), 'id' => $this->workspace->getId());
     $details['receiverUser'] = array('firstName' => $this->user->getFirstName(), 'lastName' => $this->user->getLastName());
     $this->details = $details;
     parent::__construct(self::ACTION, $this->details, $this->user, null, null, $this->role, $this->workspace);
 }
 public function addUserQueue(Workspace $workspace, User $user)
 {
     $wksrq = new WorkspaceRegistrationQueue();
     $wksrq->setUser($user);
     $role = $this->roleManager->getCollaboratorRole($workspace);
     $wksrq->setRole($role);
     $wksrq->setWorkspace($workspace);
     $this->om->persist($wksrq);
     $this->om->flush();
 }
 public function validateRegistration(WorkspaceRegistrationQueue $wksqrq)
 {
     $this->roleManager->associateRolesToSubjects(array($wksqrq->getUser()), array($wksqrq->getRole()), true);
     $this->objectManager->remove($wksqrq);
     $this->objectManager->flush();
 }