WIP: feature_paste #1
|
@ -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
|
||||
skobkin
commented
`show_paste` at least.
|
||||
{
|
||||
$paste = $pasteRepository->findOneBy(['id' => $id, 'secret' => $secret]);
|
||||
|
|
Loading…
Reference in a new issue
I'd suggest explicitly defining which request methods we're processing here.
P.S. We'll move this to YAML in the end.