3
votes

I am new in Symfony development and I have created my first project and my first bundle with the command line php app\console generate:bundle.

Normally, I should be able to use this new bundle and access to the URL hello/{name}, but when I am trying to access to the URL http://localhost/mylibrary-web/web/app_dev.php/hello/test/ I am getting this error message :

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").

How can I resolve this issue ?

Here the routing files of my project :

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 }

Thank you for your help !

Edit : here the result of the command line 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

Edit 2 : After clearing the cache with the command line php app\console cache:clear I have now the following error :

ContextErrorException in classes.php line 6415: Warning: filemtime(): stat failed for C:\wamp\www\mylibrary-web\app\cache\dev/annotations/597877fc1359850fa8786ead82dcc8f6f491d628.cache.php
1
add output of php app/console debug:router hereghanbari
@ghanbari : Thx for your help ! I have updated my post with the output of the requested command line !rolandl
search routing_dev in your project, and if exist in any routing file, delete itghanbari
Can you try a hard cache clear? rm -rf app/cache/* or just delete all folders found inside of app/cache. Also check the annotations found in @AppBundle/Controller/ to ensure there's no back-references to routing_devsjagr
@ghanbari I finally found where the issue comes from. I have posted the solution into a new answer ! thx for your help !rolandl

1 Answers

2
votes

I finally found the solution... The issue comes from OPCache and the following setting : opcache.enable_file_override=1. After changing with opcache.enable_file_override=0 everything works :)