Выводит ошибу
Unable to generate a URL for the named route "/blog/{page}" as such route does not exist.
и если изменить на корень
return $this->redirect($this->generateUrl('/'));
то тоже ошибка
app:
resource: '@AppBundle/Controller/'
type: annotation
blog_list:
path: /blog/{page}
defaults: { _controller: AppBundle:Blog:list, page: 1 }
requirements:
page: '\d+'
blog_show:
path: /blog/{slug}
defaults: { _controller: AppBundle:Blog:show }
<?php
// src/AppBundle/Controller/BlogController.php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\HttpFoundation\Response;
class BlogController extends AbstractController
{
public function listAction($page = 1)
{
echo 333;
echo '<br>';
echo '<br>';
die($page);
}
public function showAction ( $slug )
{
return $this->redirect($this->generateUrl('/blog/{page}'));
die($slug);
}
}