在 Symfony2 中创建 Bundle 后出现 FileLoaderImportCircularReferenceException

FileLoaderImportCircularReferenceException after created Bundle in Symfony2

我是 Symfony 开发的新手,我用命令行创建了我的第一个项目和第一个包 php app\console generate:bundle

通常,我应该能够使用这个新包并访问 URL hello/{name},但是当我尝试访问 URL http://localhost/mylibrary-web/web/app_dev.php/hello/test/我收到此错误消息:

FileLoaderImportCircularReferenceException in FileLoader.php line 97: Circular reference detected in "C:\wamp\www\mylibrary-web\app/config/routing_dev.yml" ("C:\wamp\www\mylibrary-web\app/config/routing_dev.yml" > "C:\wamp\www\mylibrary-web\app/config\routing.yml" > "C:\wamp\www\mylibrary-web\app/config/routing_dev.yml").

我该如何解决这个问题?

这里是我项目的路由文件:

C:\wamp\www\mylibrary-web\app\config\routing_dev.yml :

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_configurator:
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

_errors:
    resource: "@TwigBundle/Resources/config/routing/errors.xml"
    prefix:   /_error

_main:
    resource: routing.yml

C:\wamp\www\mylibrary-web\app\config\routing.yml :

my_library_library:
    resource: "@MyLibraryLibraryBundle/Resources/config/routing.yml"
    prefix:   /

app:
    resource: "@AppBundle/Controller/"
    type:     annotation

C:\wamp\www\mylibrary-web\src\MyLibrary\LibraryBundle\Resources\config\routing.yml :

my_library_library_homepage:
    path:     /hello/{name}
    defaults: { _controller: MyLibraryLibraryBundle:Default:index }

感谢您的帮助!

编辑:这里是命令行的结果php app\console debug:router

C:\wamp\www\mylibrary-web>php app\console debug:router
[router] Current routes
 Name                        Method Scheme Host Path
 _wdt                        ANY    ANY    ANY  /_wdt/{token}
 _profiler_home              ANY    ANY    ANY  /_profiler/
 _profiler_search            ANY    ANY    ANY  /_profiler/search
 _profiler_search_bar        ANY    ANY    ANY  /_profiler/search_bar
 _profiler_purge             ANY    ANY    ANY  /_profiler/purge
 _profiler_info              ANY    ANY    ANY  /_profiler/info/{about}
 _profiler_phpinfo           ANY    ANY    ANY  /_profiler/phpinfo
 _profiler_search_results    ANY    ANY    ANY  /_profiler/{token}/search/results
 _profiler                   ANY    ANY    ANY  /_profiler/{token}
 _profiler_router            ANY    ANY    ANY  /_profiler/{token}/router
 _profiler_exception         ANY    ANY    ANY  /_profiler/{token}/exception
 _profiler_exception_css     ANY    ANY    ANY  /_profiler/{token}/exception.css
 _configurator_home          ANY    ANY    ANY  /_configurator/
 _configurator_step          ANY    ANY    ANY  /_configurator/step/{index}
 _configurator_final         ANY    ANY    ANY  /_configurator/final
 _twig_error_test            ANY    ANY    ANY  /_error/{code}.{_format}
 my_library_library_homepage ANY    ANY    ANY  /hello/{name}
 homepage                    ANY    ANY    ANY  /app/example

编辑 2:使用命令行清除缓存后 php app\console cache:clear 我现在遇到以下错误:

ContextErrorException in classes.php line 6415: Warning: filemtime(): stat failed for C:\wamp\www\mylibrary-web\app\cache\dev/annotations/597877fc1359850fa8786ead82dcc8f6f491d628.cache.php

我终于找到了解决方案...问题来自 OPCache 和以下设置:opcache.enable_file_override=1。用 opcache.enable_file_override=0 更改后一切正常:)