public function viewBlogPostAction(PageInterface $blogPost, $slug) { if (ElcodiPageTypes::TYPE_BLOG_POST !== $blogPost->getType()) { $this->createNotFoundException(); } /** * We must check that the product slug is right. Otherwise we must * return a Redirection 301 to the right url */ if ($slug !== $blogPost->getPath()) { return $this->redirectToRoute('store_blog_post_view', ['id' => $blogPost->getId(), 'slug' => $blogPost->getPath()]); } return $this->renderTemplate('Pages:blog-post-view.html.twig', ['blog_post' => $blogPost]); }