| @@ 156-169 (lines=14) @@ | ||
| 153 | * } |
|
| 154 | * ) |
|
| 155 | */ |
|
| 156 | public function createAction(Request $request): Response |
|
| 157 | { |
|
| 158 | $form = $this->createEventCreationForm(); |
|
| 159 | $this->processForm($request, $form); |
|
| 160 | ||
| 161 | if ($form->isValid()) { |
|
| 162 | $eventService = $this->get('rockparade.event'); |
|
| 163 | $response = $eventService->createEventByForm($form, $this->getUser()); |
|
| 164 | } else { |
|
| 165 | $response = new ApiError($this->getFormErrors($form), Response::HTTP_BAD_REQUEST); |
|
| 166 | } |
|
| 167 | ||
| 168 | return $this->respond($response); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Edit event |
|
| @@ 206-219 (lines=14) @@ | ||
| 203 | * ) |
|
| 204 | * @param string $eventId event id |
|
| 205 | */ |
|
| 206 | public function editAction(Request $request, string $eventId): Response |
|
| 207 | { |
|
| 208 | $form = $this->createEventCreationForm(); |
|
| 209 | $this->processForm($request, $form); |
|
| 210 | ||
| 211 | if ($form->isValid()) { |
|
| 212 | $eventService = $this->get('rockparade.event'); |
|
| 213 | $response = $eventService->editEventByForm($form, $eventId); |
|
| 214 | } else { |
|
| 215 | $response = new ApiError($this->getFormErrors($form), Response::HTTP_BAD_REQUEST); |
|
| 216 | } |
|
| 217 | ||
| 218 | return $this->respond($response); |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * Delete event |
|