Parcourir la source

Correction id sur page

Sangfroid il y a 8 mois
Parent
commit
ab979fae6d
2 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 1 1
      src/Controller/PageController.php
  2. 5 0
      src/Entity/Page.php

+ 1 - 1
src/Controller/PageController.php

@@ -26,7 +26,7 @@ class PageController extends AbstractController
         ]);
     }
 
-    #[Route('/p/edit/{name}', name: 'app_page_edit', methods: ['GET', 'POST'])]
+    #[Route('/p/edit/{id}', name: 'app_page_edit', methods: ['GET', 'POST'])]
     public function editPage(Request $request, Page $page, EntityManagerInterface $em): Response
     {
         $form = $this->createForm(PageType::class, $page);

+ 5 - 0
src/Entity/Page.php

@@ -17,6 +17,11 @@ class Page
     #[ORM\Column(type: Types::TEXT)]
     private ?string $content = null;
 
+    public function getId(): ?string
+    {
+        return $this->getName();
+    }
+
     public function getName(): ?string
     {
         return $this->name;