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