路由循环参考
Routing Circular reference
这是我的app/config/routing.yml
AppBundle:
resource: "@AppBundle/Controller/"
type: annotation
prefix: /
RapportBundle:
resource: "@RapportBundle/Controller/"
type: annotation
prefix: /rapport
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
RapportBundle/Controller/RapportController.php
<?php
namespace RapportBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class RapportController extends Controller
{
/**
* @Template
* @Route("/", name="rapport_index")
*/
public function indexAction()
{
return [];
}
}
和 AppBundle/Controller/DefaultController.php
的相同文件
当我从 DefaultController 启动我的索引时,我得到了这个:
Circular reference detected in "/var/www/my-site/app/config/routing_dev.yml" ("/var/www/my-site/app/config/routing_dev.yml" > "/var/www/my-site/app/config/routing.yml" > "/var/www/my-site/app/config/routing_dev.yml").
(我的routing_dev.yml没改,是Symfony2 base)
你知道为什么吗?
我自己回答:
我只是忘了将 RapportBundle 添加到 AppKernel....
这是我的app/config/routing.yml
AppBundle:
resource: "@AppBundle/Controller/"
type: annotation
prefix: /
RapportBundle:
resource: "@RapportBundle/Controller/"
type: annotation
prefix: /rapport
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
RapportBundle/Controller/RapportController.php
<?php
namespace RapportBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class RapportController extends Controller
{
/**
* @Template
* @Route("/", name="rapport_index")
*/
public function indexAction()
{
return [];
}
}
和 AppBundle/Controller/DefaultController.php
的相同文件当我从 DefaultController 启动我的索引时,我得到了这个:
Circular reference detected in "/var/www/my-site/app/config/routing_dev.yml" ("/var/www/my-site/app/config/routing_dev.yml" > "/var/www/my-site/app/config/routing.yml" > "/var/www/my-site/app/config/routing_dev.yml").
(我的routing_dev.yml没改,是Symfony2 base)
你知道为什么吗?
我自己回答:
我只是忘了将 RapportBundle 添加到 AppKernel....