I'm getting crazy with this circular reference issue and I can't find what I'm doing wrong. This is the content of /app/config/routing.yml
:
pd_one:
resource: "@PDOneBundle/Controller/"
type: annotation
prefix: /
template:
resource: "@TemplateBundle/Controller/"
type: annotation
prefix: /
fos_user:
prefix: /admin
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
restful_services:
resource: "@PDOneBundle/Resources/config/routing.yml"
type: rest
prefix: /api
nelmio_apidoc:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
This is the content of /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
And finally this is the content of /src/PDI/PDOneBundle/Resources/config/routing.yml
:
service_company:
type: rest
prefix: /v1
resource: PDOneBundle\Controller\CompanyRestController
name_prefix: api_1_ # naming collision
Any time I tried some URL at dev
env I got this error:
FileLoaderImportCircularReferenceException in classes.php line 7527: Circular reference detected in "/var/www/html/reptooln_admin/app/config/routing_dev.yml" ("/var/www/html/reptooln_admin/app/config/routing_dev.yml" > "/var/www/html/reptooln_admin/app/config/routing.yml" > "/var/www/html/reptooln_admin/src/PDI/PDOneBundle/Resources/config/routing.yml"
"/var/www/html/reptooln_admin/app/config/routing_dev.yml").
This is the full stack trace|logs:
in classes.php line 7527
at FileLoader->import('/var/www/html/reptooln_admin/app/config/routing_dev.yml', null, false, '/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml') in YamlFileLoader.php line 155
at YamlFileLoader->parseImport(object(RouteCollection), array('resource' => '/var/www/html/reptooln_admin/app/config/routing_dev.yml'), '/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml', '/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml') in YamlFileLoader.php line 91
at YamlFileLoader->load('/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml', 'yaml') in DelegatingLoader.php line 45
at DelegatingLoader->load('/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml', 'yaml') in DelegatingLoader.php line 58
at DelegatingLoader->load('/var/www/html/reptooln_admin/app/cache/dev/assetic/routing.yml', 'yaml') in classes.php line 11649
at Router->getRouteCollection() in classes.php line 11619
at Router->getGeneratorDumperInstance() in classes.php line 11600
at Router->getGenerator() in classes.php line 11545
at Router->generate('_profiler', array('token' => 'ccd0d6')) in WebDebugToolbarListener.php line 66
at WebDebugToolbarListener->onKernelResponse(object(FilterResponseEvent), 'kernel.response', object(TraceableEventDispatcher))
at call_user_func(array(object(WebDebugToolbarListener), 'onKernelResponse'), object(FilterResponseEvent), 'kernel.response', object(TraceableEventDispatcher)) in WrappedListener.php line 61
at WrappedListener->__invoke(object(FilterResponseEvent), 'kernel.response', object(ContainerAwareEventDispatcher))
at call_user_func(object(WrappedListener), object(FilterResponseEvent), 'kernel.response', object(ContainerAwareEventDispatcher)) in classes.php line 12147
at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.response', object(FilterResponseEvent)) in classes.php line 12080
at EventDispatcher->dispatch('kernel.response', object(FilterResponseEvent)) in classes.php line 12241
at ContainerAwareEventDispatcher->dispatch('kernel.response', object(FilterResponseEvent)) in TraceableEventDispatcher.php line 112
at TraceableEventDispatcher->dispatch('kernel.response', object(FilterResponseEvent)) in bootstrap.php.cache line 3049
at HttpKernel->filterResponse(object(Response), object(Request), '2') in bootstrap.php.cache line 3044
at HttpKernel->handleRaw(object(Request), '2') in bootstrap.php.cache line 2991
at HttpKernel->handle(object(Request), '2', true) in bootstrap.php.cache line 3140
at ContainerAwareHttpKernel->handle(object(Request), '2', true) in ExceptionListener.php line 58
at ExceptionListener->onKernelException(object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
at call_user_func(array(object(ExceptionListener), 'onKernelException'), object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher)) in WrappedListener.php line 61
at WrappedListener->__invoke(object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher))
at call_user_func(object(WrappedListener), object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher)) in classes.php line 12147
at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(GetResponseForExceptionEvent)) in classes.php line 12080
at EventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in classes.php line 12241
at ContainerAwareEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in TraceableEventDispatcher.php line 112
at TraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in bootstrap.php.cache line 3061
at HttpKernel->handleException(object(FileLoaderLoadException), object(Request), '1') in bootstrap.php.cache line 2997
at HttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 3140
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in bootstrap.php.cache line 2384
at Kernel->handle(object(Request)) in app_dev.php line 14
Where is the issue? What I'm doing wrong? I'm trying to setup NelmioApiDoc and FOSRestBundle
EDIT 1
I have fixed the previous issue but got another similar. This are the changes I made.
/app/config/routing.yml
#PDOne
# just leave in .yml file
pdone:
resource: "@PDOneBundle/Resources/config/routing.yml"
# comment this out just for find where is the problem
#template:
# resource: "@TemplateBundle/Controller/"
# type: annotation
# prefix: /
#FOSUserBundle
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
prefix: /
NelmioApiDocBundle:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
#SonataAdmin
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
/src/PDI/PDOneBundle/Resources/config/routing.yml
#sets this one as annotation
pdone:
type: annotation
prefix: /
resource: "@PDOneBundle/Controller/"
#this ones will be for restful API
companies:
type: rest
prefix: /api/v1/companies
resource: PDOneBundle\Controller\Rest\CompanyRestController
And error change to this:
FileLoaderImportCircularReferenceException in classes.php line 13960: Circular reference detected in "/var/www/html/reptooln_admin/app/config/routing_dev.yml" ("/var/www/html/reptooln_admin/app/config/routing_dev.yml" > "/var/www/html/reptooln_admin/app/config/routing.yml" > "/var/www/html/reptooln_admin/src/PDI/PDOneBundle/Resources/config/routing.yml"
"PDOneBundle\Controller\Rest\CompanyRestController" > "/var/www/html/reptooln_admin/app/config/routing_dev.yml").
Where is the problem at /src/PDI/PDOneBundle/Resources/config/routing.yml
? Can't live annotation
and rest
types at same YML file? How do I deal with this?