| @@ 46-55 (lines=10) @@ | ||
| 43 | * |
|
| 44 | * @return \League\Fractal\TransformerAbstract |
|
| 45 | */ |
|
| 46 | public function getSingle(Request $request, Response $response, array $args) |
|
| 47 | { |
|
| 48 | $alert = $this->repository->readSingleById($args['id']); |
|
| 49 | ||
| 50 | if (empty($alert)) { |
|
| 51 | return $this->errorEmpty($response); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $this->respond('item', $alert, $this->transformer, $request, $response); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * Returns all currently running alerts |
|
| @@ 65-74 (lines=10) @@ | ||
| 62 | * |
|
| 63 | * @return \League\Fractal\TransformerAbstract |
|
| 64 | */ |
|
| 65 | public function getActives(Request $request, Response $response) |
|
| 66 | { |
|
| 67 | $actives = $this->repository->readAllByFields(['InProgress' => 1]); |
|
| 68 | ||
| 69 | if (empty($actives)) { |
|
| 70 | return $this->errorEmpty($response); |
|
| 71 | } |
|
| 72 | ||
| 73 | return $this->respond('collection', $actives, $this->transformer, $request, $response); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||