not found on wrong post in main page
This commit is contained in:
parent
cfe7d9339c
commit
86f4accd78
1 changed files with 3 additions and 0 deletions
|
@ -45,6 +45,9 @@ class PostController extends AbstractController
|
|||
public function post(Request $request, string $slug): Response
|
||||
{
|
||||
$post = $this->getDoctrine()->getRepository(Post::class)->findOneBy(array('slug' => $slug));
|
||||
if (!$post) {
|
||||
throw $this->createNotFoundException("Post not found");
|
||||
}
|
||||
$form = $this->commentFormGenerator($post);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
|
Reference in a new issue