From 00cd03f43d71c933d3f7ddfec17f4d00222af75a Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Thu, 4 Oct 2018 21:01:45 +0200 Subject: [PATCH] Implemented law standart template --- application/src/Controller/LawController.php | 16 +++++++++++----- application/src/Repository/LawRepository.php | 14 ++++++++++++++ application/templates/law/law.html.twig | 6 ++++++ .../templates/law/view/standard.html.twig | 17 +++++++++++++++++ 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 application/src/Repository/LawRepository.php create mode 100644 application/templates/law/law.html.twig create mode 100644 application/templates/law/view/standard.html.twig diff --git a/application/src/Controller/LawController.php b/application/src/Controller/LawController.php index 12e5ec2..60cff99 100644 --- a/application/src/Controller/LawController.php +++ b/application/src/Controller/LawController.php @@ -6,6 +6,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\HttpFoundation\Request; use App\Entity\Law; +use App\Entity\LawInterface; /** * @@ -19,12 +20,17 @@ class LawController extends AbstractEntityController * * @Route("/law/{id}.{_format}", defaults={"_format"="html"}) */ - public function show(): Response + public function show(int $id): Response { - /** - * - * @todo Implement function! - */ + /** + * + * @var LawInterface $law + */ + $law = $this->loadEntityById($id); + $view = $this->view($law, 200) + ->setTemplate('law/view/standard.html.twig') + ->setTemplateVar('law'); + return $this->handleView($view); } /** diff --git a/application/src/Repository/LawRepository.php b/application/src/Repository/LawRepository.php new file mode 100644 index 0000000..58e5f45 --- /dev/null +++ b/application/src/Repository/LawRepository.php @@ -0,0 +1,14 @@ + + {% trans %} + Law + {% endtrans %} + # + {{ law.id }} + +{% trans %} +Responsible for: +{% endtrans %} + {% trans with {'%law.node.id%':law.node.id}%} + node #%law.node.id% {% endtrans %} + +. +{% endblock %}