Symfony2 FOSUserBundle错误-FileLoaderImportCircularReferenceException[英] Symfony2 FOSUserBundle error - FileLoaderImportCircularReferenceException

本文是小编为大家收集整理的关于Symfony2 FOSUserBundle错误-FileLoaderImportCircularReferenceException的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在尝试在一个新的Symfony2项目中安装FosuserBundle.我已经遵循了安装的步骤,但是我仍然在此错误上遇到麻烦:

FileLoaderImportCircularReferenceException in FileLoader.php line 97:
Circular reference detected in "/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml" ("/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml" > "/Users/tom/Sites/symfony/todo/app/config/routing.yml" > "/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml").

当我尝试运行php app/console router:debug时,我会遇到错误:

 [Symfony\Component\Config\Exception\FileLoaderLoadException]                                              
  Cannot load resource "@FOSUserBundle/Resources/config/routing/all.xml". Make sure the "FOSUserBundle" bu  
  ndle is correctly registered and loaded in the application kernel class.     

即使我正在将捆绑包加载到Appkernel中.

在路由中,我有(如果有帮助):

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

似乎在这方面找不到任何东西,但是如果我没有足够的搜索,我深表歉意.

推荐答案

已从项目中删除了Acmedemobundle,但没有从routing_dev.yml文件中删除相关的路由代码.

其他推荐答案

如果缓存不适合您,请查看您是否包括所需的使用注释路由的名称空间,在我的情况下,我缺少添加:

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

在我的控制器中. 我打开一个问题,因为这种情况的异常投掷是错误的,因为它说相同的错误:

FileLoaderImportCircularReferenceException

其他推荐答案

如果删除该行,这也会发生:

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

来自您的控制器. Symfony需要@Route注释的这一行.

本文地址:https://www.itbaoku.cn/post/2090810.html

问题描述

I'm trying to install FOSUserBundle on a new symfony2 project. I've followed the steps to get it installed but I'm still having trouble with this error:

FileLoaderImportCircularReferenceException in FileLoader.php line 97:
Circular reference detected in "/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml" ("/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml" > "/Users/tom/Sites/symfony/todo/app/config/routing.yml" > "/Users/tom/Sites/symfony/todo/app/config/routing_dev.yml").

When I try to run php app/console router:debug I am getting the error:

 [Symfony\Component\Config\Exception\FileLoaderLoadException]                                              
  Cannot load resource "@FOSUserBundle/Resources/config/routing/all.xml". Make sure the "FOSUserBundle" bu  
  ndle is correctly registered and loaded in the application kernel class.     

Even though I am loading the bundle in the AppKernel.

In routing.yml I have (if it helps):

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

Can't seem to find anything on this however I apologise if I haven't searched around well enough.

推荐答案

Had deleted the AcmeDemoBundle from the project but hadn't removed the related routing code from the routing_dev.yml file.

其他推荐答案

If cache does not work for you, look if you are include the required namespaces for use annotations routes in your controller, in my case i was missing to add:

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

in my controller. I open an issue because the exception throw is wrong for this case, since it says the same error:

FileLoaderImportCircularReferenceException

其他推荐答案

This will also happen if you delete the line:

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

from your Controller. Symfony needs this line for the @Route annotation.