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