Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Powiedzmy, ze masz takie cos (kopia z twojego kodu)
- if ($this->redirect) {
- $this->response = $this->redirect;
- } elseif (is_null($this->response)) {
- $this->response = $this->render('matrix/swot.html.twig', [
- 'form' => $this->form->createView(),
- 'matrixview' => $this->matrix->getView(),
- 'page' => $this->getDoctrine()->getManager()->getRepository(Page::class)->findOneByRoute($request->get('_route')),
- ]);
- }
- return $this->response;
- // Mozesz to zapisac inaczej
- // Zero zmian funkcjonalnych, kod bedzie dzialal identycznie.
- if ($this->redirect) {
- return $this->redirect;
- }
- return $this->render('matrix/swot.html.twig', [
- 'form' => $this->form->createView(),
- 'matrixview' => $this->matrix->getView(),
- 'page' => $this->getDoctrine()->getManager()->getRepository(Page::class)->findOneByRoute($request->get('_route')),
- ]);
- // Od razu czyta sie przyjemniej imho
- // Mozna nawet
- return !$this->redirect ?
- $this->render('matrix/swot.html.twig', [
- 'form' => $this->form->createView(),
- 'matrixview' => $this->matrix->getView(),
- 'page' => $this->getDoctrine()->getManager()->getRepository(Page::class)->findOneByRoute($request->get('_route')),
- ]) : $this->redirect;
Advertisement
Add Comment
Please, Sign In to add comment