| @@ 124-137 (lines=14) @@ | ||
| 121 | * @return array |
|
| 122 | * @throws \Exception |
|
| 123 | */ |
|
| 124 | public function updateTask($input, $taskId) |
|
| 125 | { |
|
| 126 | $task = $this->checkTask($taskId); |
|
| 127 | $data = $this->validateInputOnUpdateTask($input, $task); |
|
| 128 | $repository = new TasksRepository; |
|
| 129 | $query = $repository->updateTaskQuery(); |
|
| 130 | $statement = $this->database->prepare($query); |
|
| 131 | $statement->bindParam('id', $taskId); |
|
| 132 | $statement->bindParam('task', $data['task']); |
|
| 133 | $statement->bindParam('status', $data['status']); |
|
| 134 | $statement->execute(); |
|
| 135 | ||
| 136 | return $this->checkTask($taskId); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Delete a task. |
|
| @@ 122-135 (lines=14) @@ | ||
| 119 | * @return array |
|
| 120 | * @throws \Exception |
|
| 121 | */ |
|
| 122 | public function updateUser($input, $userId) |
|
| 123 | { |
|
| 124 | $user = $this->checkUser($userId); |
|
| 125 | $data = $this->validateInputOnUpdateUser($input, $user); |
|
| 126 | $repository = new UsersRepository; |
|
| 127 | $query = $repository->updateUserQuery(); |
|
| 128 | $statement = $this->database->prepare($query); |
|
| 129 | $statement->bindParam('id', $userId); |
|
| 130 | $statement->bindParam('name', $data['name']); |
|
| 131 | $statement->bindParam('email', $data['email']); |
|
| 132 | $statement->execute(); |
|
| 133 | ||
| 134 | return $this->checkUser($userId); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Delete a user. |
|