public function getGit(Project $project, PFUser $user, $limit, $offset, $fields) { $results = array(); $git_repositories = $this->repository_factory->getPagninatedRepositoriesUserCanSee($project, $user, $limit, $offset); foreach ($git_repositories as $repository) { $results[] = $this->repository_resource_builder->build($user, $repository, $fields); } return array('repositories' => $results); }
/** * @access hybrid * * @param int $id Id of the repository * @return GitRepositoryRepresentation | null * * @throws 403 * @throws 404 */ public function get($id) { $this->checkAccess(); $user = $this->getCurrentUser(); try { $repository = $this->repository_factory->getRepositoryByIdUserCanSee($user, $id); return $this->representation_builder->build($user, $repository, GitRepositoryRepresentationBase::FIELDS_ALL); } catch (GitRepoNotReadableException $exception) { throw new RestException(403, 'Git repository not accessible for user'); } catch (GitRepoNotFoundException $exception) { throw new RestException(404, 'Git repository not found'); } catch (Exception $exception) { throw new RestException(403, 'Project not accessible for user'); } }