diff --git a/src/Controller/PasteController.php b/src/Controller/PasteController.php index 6f411f6..057f0d2 100644 --- a/src/Controller/PasteController.php +++ b/src/Controller/PasteController.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\Request; class PasteController extends AbstractController { - #[Route('/')] + #[Route('/', name: 'homepage')] public function new(Request $request, PasteRepository $pasteRepository): Response { $pasteData = new PasteFormData(); @@ -28,7 +28,7 @@ class PasteController extends AbstractController $paste = Paste::fromFormDataAndIp($pasteData, $request->getClientIp()); $pasteRepository->save($paste, true); - return $this->redirectToRoute($request->attributes->get('_route')); + return $this->redirectToRoute('showpaste', ['id' => $paste->id, 'secret' => $paste->secret]); } return $this->render('paste.html.twig', [ @@ -36,7 +36,7 @@ class PasteController extends AbstractController ]); } - #[Route('/{id}/{secret}')] + #[Route('/{id}/{secret}', name: 'showpaste')] public function showPaste(PasteRepository $pasteRepository, string $id, ?string $secret = NULL): Response { $paste = $pasteRepository->findOneBy(['id' => $id, 'secret' => $secret]);