| @@ 34-49 (lines=16) @@ | ||
| 31 | * @param Request $request |
|
| 32 | * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response |
|
| 33 | */ |
|
| 34 | public function indexAction(Request $request) |
|
| 35 | { |
|
| 36 | if (!$this->isGranted(AccessVoter::CREATE, RateInterface::class)) { |
|
| 37 | throw $this->createAccessDeniedException(); |
|
| 38 | } |
|
| 39 | ||
| 40 | $form = $this->getForm(); |
|
| 41 | ||
| 42 | if (true === $this->handleForm($form, $request)) { |
|
| 43 | return $this->redirectAfterSuccess(); |
|
| 44 | } |
|
| 45 | ||
| 46 | return $this->render('@ExchangeRate/create.html.twig', [ |
|
| 47 | 'form' => $form->createView(), |
|
| 48 | ]); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Handle form submission. |
|
| @@ 26-38 (lines=13) @@ | ||
| 23 | */ |
|
| 24 | class ListController extends Controller |
|
| 25 | { |
|
| 26 | public function indexAction(Request $request) |
|
| 27 | { |
|
| 28 | if (!$this->isGranted(AccessVoter::VIEW, RateInterface::class)) { |
|
| 29 | throw $this->createAccessDeniedException(); |
|
| 30 | } |
|
| 31 | ||
| 32 | $filterForm = $this->getFilterForm($request); |
|
| 33 | ||
| 34 | return $this->render('@ExchangeRate/list.html.twig', [ |
|
| 35 | 'rates' => $this->getRates($filterForm), |
|
| 36 | 'form' => $filterForm->createView(), |
|
| 37 | ]); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Get rates for list view. Process filters if submitted. |
|