public function clearRoles(Project $project) { foreach ($this->userRoles as $userRole) { if ($userRole->getProject() == $project) { $this->userRoles->removeElement($userRole); } } }
/** * Remove userRoles. * * @param UserRole $userRoles */ public function removeUserRole(UserRole $userRoles) { $this->userRoles->removeElement($userRoles); }
/** * @return User[] */ public function getUserRoles() { $sortedRoles = $this->userRoles->toArray(); usort($sortedRoles, function (UserRole $a, UserRole $b) { return $a->getUser()->getUsername() < $b->getUser()->getUsername() ? -1 : 1; }); return $sortedRoles; }
/** * @return UserRoleInterface[] */ public function getRoles() { return $this->userRole->getValues(); }
public function addUserRole(UserRole $userRole) { $this->userRoles->add($userRole); }