[ 'id' => '1', 'title' => 'Title 1', 'body' => 'Body 1', 'authorName' => 'Fred', ], 2 => [ 'id' => '2', 'title' => 'Title 2', 'body' => 'Body 2', 'authorName' => 'Outi', ], 3 => [ 'id' => '3', 'title' => 'Title 3', 'body' => 'Body 3', 'authorName' => 'François', ], ]; /** * @param $page * * @return Response * * @Route( * name ="blog_list", * path ="/blog/{page}", * requirements={"page" = "\d+"} * ) */ public function list($page = 1) { return $this->render('blog/index.html.twig', [ 'blog_entries' => static::POSTS, 'pager' => "Page $page of the blog list.", ]); } /** * @param $slug * * @return \Symfony\Component\HttpFoundation\Response * * @Route( * name = "blog_show", * path = "/blog/{slug}" * ) */ public function show($slug) { $path = $this->generateUrl('blog_list', [ // Placeholder: fit in the path. 'page' => 2, // Non-placeholder: fit in the query 'foo' => 'bar', ], UrlGeneratorInterface::ABSOLUTE_PATH); return new Response("Show $slug. Back to page 2: $path"); } }