diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-05-22 15:33:16 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-05-22 15:33:16 -0400 |
commit | 54a751820f39e8891f775b8d9293349399b3e8c2 (patch) | |
tree | 777636eb37fd2dc3af959171a64eb14933641dec /app/Api/Procedure/ProjectProcedure.php | |
parent | f16ac8cd66b107f04db78a70521a959eca85159a (diff) |
Add task and project API formatters
Diffstat (limited to 'app/Api/Procedure/ProjectProcedure.php')
-rw-r--r-- | app/Api/Procedure/ProjectProcedure.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/Api/Procedure/ProjectProcedure.php b/app/Api/Procedure/ProjectProcedure.php index e8a34cd3..c9ac0ae6 100644 --- a/app/Api/Procedure/ProjectProcedure.php +++ b/app/Api/Procedure/ProjectProcedure.php @@ -15,33 +15,34 @@ class ProjectProcedure extends BaseProcedure public function getProjectById($project_id) { ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectById', $project_id); - return $this->formatProject($this->projectModel->getById($project_id)); + $project = $this->projectModel->getById($project_id); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByName($name) { $project = $this->projectModel->getByName($name); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByName', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByIdentifier($identifier) { - $project = $this->formatProject($this->projectModel->getByIdentifier($identifier)); + $project = $this->projectModel->getByIdentifier($identifier); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByIdentifier', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByEmail($email) { - $project = $this->formatProject($this->projectModel->getByEmail($email)); + $project = $this->projectModel->getByEmail($email); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByEmail', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getAllProjects() { - return $this->formatProjects($this->projectModel->getAll()); + return $this->projectsApiFormatter->withProjects($this->projectModel->getAll())->format(); } public function removeProject($project_id) |