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