@@ 113-126 (lines=14) @@ | ||
110 | * ) |
|
111 | * @param string $eventId event id |
|
112 | */ |
|
113 | public function viewAction(string $eventId): Response |
|
114 | { |
|
115 | /** @var EventRepository $eventRepository */ |
|
116 | $eventRepository = $this->get('rockparade.event_repository'); |
|
117 | $event = $eventRepository->findOneById($eventId); |
|
118 | ||
119 | if ($event) { |
|
120 | $response = new ApiResponse($event, Response::HTTP_OK); |
|
121 | } else { |
|
122 | $response = $this->createEventNotFoundErrorResult($eventId); |
|
123 | } |
|
124 | ||
125 | return $this->respond($response); |
|
126 | } |
|
127 | ||
128 | /** |
|
129 | * Create new event |
|
@@ 275-292 (lines=18) @@ | ||
272 | * ) |
|
273 | * @param string $eventId event id |
|
274 | */ |
|
275 | public function deleteEvent(string $eventId): Response |
|
276 | { |
|
277 | /** @var EventRepository $eventRepository */ |
|
278 | $eventRepository = $this->get('rockparade.event_repository'); |
|
279 | $event = $eventRepository->findOneById($eventId); |
|
280 | ||
281 | if ($event) { |
|
282 | $eventRepository->remove($event); |
|
283 | $eventRepository->flush(); |
|
284 | ||
285 | $response = new EmptyApiResponse(Response::HTTP_NO_CONTENT); |
|
286 | } else { |
|
287 | $response = $this->createEventNotFoundErrorResult($eventId); |
|
288 | } |
|
289 | ||
290 | return $this->respond($response); |
|
291 | } |
|
292 | ||
293 | /** |
|
294 | * Add image to event |
|
295 | * @Route("/{eventId}/image", name="event_image_add") |