UE code * * @return groups The list of groups for this UE * ---------------------------------------------------------*/ public static function get($args){ $code = ""; extract($args); /* Get the cours repo */ /** @var cours $cours_repo */ $cours_repo = Repo::getRepo('cours'); /* (1) Try to fetch data */ $fetched = $cours_repo->getGroups($code); /* (2) Manage error */ if( is_null($fetched) || !is_array($fetched) ) return ['error' => new Error(Err::RepoError)]; /* (3) Parse JSON list */ foreach($fetched as $f=>$v) $fetched[$f]['formations'] = json_decode($v['formations']); return ['groups' => $fetched]; } }