diff --git a/administration/test-everything.sh b/administration/test-everything.sh index df55d66..233d119 100644 --- a/administration/test-everything.sh +++ b/administration/test-everything.sh @@ -3,5 +3,5 @@ cd "$(dirname "$(readlink -f "${0}")")/" && bash ./clear.sh && bash ./schema-validate.sh && bash ./test.sh && -bash ./test-code-format.sh +bash ./test-code-format.sh && bash ./shellcheck.sh diff --git a/application/src/Controller/API/APIControllerInterface.php b/application/src/Controller/API/APIControllerInterface.php new file mode 100644 index 0000000..e98e9fe --- /dev/null +++ b/application/src/Controller/API/APIControllerInterface.php @@ -0,0 +1,19 @@ +loadEntityById($id); - $view = $this->view($law, 200) - ->setTemplate('law/view/standard.html.twig') - ->setTemplateVar('law'); - - return $this->handleView($view); - } - - /** - * @Route("/law/{id}/right.{_format}", defaults={"_format"="html"}) - */ - public function right(int $id): RedirectResponse - { - /* - * - * @todo Implement function! - */ - } - - /** - * @Route("/law/{id}/node.{_format}", defaults={"_format"="html"}) - */ - public function node(int $id): RedirectResponse - { - /* - * - * @todo Implement function! - */ - } - - protected function setEntityName(): void - { - $this->entityName = Law::class; - } -} diff --git a/application/src/Controller/SourceController.php b/application/src/Controller/SourceController.php deleted file mode 100644 index 54f3fb2..0000000 --- a/application/src/Controller/SourceController.php +++ /dev/null @@ -1,82 +0,0 @@ -loadEntityById($id); - // $assembler = $this->get(SourceDTOAssember::class); - // $dto = $assembler->build($source, $this->getUser()); - $view = $this->view($source, 200) - ->setTemplate((new SourceTemplateFactory($source, $request))->getTemplatePath()) - ->setTemplateVar('source'); - - return $this->handleView($view); - } - - /** - * @Route("/source/{id}/edit.{_format}", defaults={"_format"="html"}) - */ - public function edit(Request $request, int $id): Response - { - $source = $this->loadEntityById($id); - $form = $this->createForm((new SourceFormFactory($source))->getNamespace(), $source); - $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - $source = $form->getData(); - $this->saveSource($source); - } - - return $this->render((new SourceTemplateFormFactory($source, $request))->getTemplatePath(), [ - 'form' => $form->createView(), - ]); - } - - /** - * @Route("/source/{id}/node.{_format}", defaults={"_format"="html"}) - */ - public function node(int $id): RedirectResponse - { - $nodeId = $this->loadNodeById($id)->getId(); - - return $this->redirectToRouteById('app_node_show', $nodeId); - } - - private function loadNodeById(int $id): RelationInterface - { - return $this->loadEntityById($id)->getNode(); - } - - private function saveSource(SourceInterface $source): void - { - $entityManager = $this->getDoctrine()->getManager(); - $entityManager->persist($source); - $entityManager->flush(); - } - - protected function setEntityName(): void - { - $this->entityName = AbstractSource::class; - } -}