/** * Wrapper to access workspace of the Step * @return \Claroline\CoreBundle\Entity\Workspace\Workspace */ public function getWorkspace() { $workspace = null; if (!empty($this->path)) { $workspace = $this->path->getWorkspace(); } return $workspace; }
/** * Get list of teams available in the Workspace of the current Path. * * @param Path $path * * @return \Symfony\Component\HttpFoundation\JsonResponse * * @Route( * "/team/{id}", * name = "innova_path_criteria_teams" * ) * @Method("GET") */ public function listTeamsAction(Path $path) { $data = []; // retrieve list of groups object for this user $teams = $this->teamManager->getTeamsByWorkspace($path->getWorkspace()); if ($teams) { // data needs to be explicitly set because Team does not extends Serializable /** @var \Claroline\TeamBundle\Entity\Team $team */ foreach ($teams as $team) { $data[$team->getId()] = $team->getName(); } } return new JsonResponse($data); }