| @@ 72-84 (lines=13) @@ | ||
| 69 | * ) |
|
| 70 | * @param string $bandName band name |
|
| 71 | */ |
|
| 72 | public function viewAction(string $bandName): Response |
|
| 73 | { |
|
| 74 | $bandRepository = $this->get('rockparade.band_repository'); |
|
| 75 | $band = $bandRepository->findOneByName($bandName); |
|
| 76 | ||
| 77 | if ($band) { |
|
| 78 | $response = new ApiResponse($band, Response::HTTP_OK); |
|
| 79 | } else { |
|
| 80 | $response = $this->createBandNotFoundErrorResult($bandName); |
|
| 81 | } |
|
| 82 | ||
| 83 | return $this->respond($response); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Create new band |
|
| @@ 187-199 (lines=13) @@ | ||
| 184 | * } |
|
| 185 | * ) |
|
| 186 | */ |
|
| 187 | public function listMembersAction(string $bandName): Response |
|
| 188 | { |
|
| 189 | $bandRepository = $this->get('rockparade.band_repository'); |
|
| 190 | $band = $bandRepository->findOneByName($bandName); |
|
| 191 | ||
| 192 | if (!$band) { |
|
| 193 | $response = $this->createBandNotFoundErrorResult($bandName); |
|
| 194 | } else { |
|
| 195 | $response = new ApiResponse($band->getMembers(), Response::HTTP_OK); |
|
| 196 | } |
|
| 197 | ||
| 198 | return $this->respond($response); |
|
| 199 | } |
|
| 200 | ||
| 201 | /** |
|
| 202 | * Add member to band |
|
| @@ 110-124 (lines=15) @@ | ||
| 107 | * ) |
|
| 108 | * @param string $eventId event id |
|
| 109 | */ |
|
| 110 | public function viewAction(string $eventId): Response |
|
| 111 | { |
|
| 112 | /** @var EventRepository $eventRepository */ |
|
| 113 | $eventRepository = $this->get('rockparade.event_repository'); |
|
| 114 | $event = $eventRepository->findOneById($eventId); |
|
| 115 | ||
| 116 | if ($event) { |
|
| 117 | $response = new ApiResponse($event, Response::HTTP_OK); |
|
| 118 | } else { |
|
| 119 | $eventService = $this->get('rockparade.event'); |
|
| 120 | $response = $eventService->createEventNotFoundErrorResult($eventId); |
|
| 121 | } |
|
| 122 | ||
| 123 | return $this->respond($response); |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * Create new event |
|
| @@ 222-239 (lines=18) @@ | ||
| 219 | * ) |
|
| 220 | * @param string $eventId event id |
|
| 221 | */ |
|
| 222 | public function deleteEvent(string $eventId): Response |
|
| 223 | { |
|
| 224 | /** @var EventRepository $eventRepository */ |
|
| 225 | $eventRepository = $this->get('rockparade.event_repository'); |
|
| 226 | $event = $eventRepository->findOneById($eventId); |
|
| 227 | ||
| 228 | if ($event) { |
|
| 229 | $eventRepository->remove($event); |
|
| 230 | $eventRepository->flush(); |
|
| 231 | ||
| 232 | $response = new EmptyApiResponse(Response::HTTP_NO_CONTENT); |
|
| 233 | } else { |
|
| 234 | $eventService = $this->get('rockparade.event'); |
|
| 235 | $response = $eventService->createEventNotFoundErrorResult($eventId); |
|
| 236 | } |
|
| 237 | ||
| 238 | return $this->respond($response); |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * Add image to event |
|