Symfony2 Routing issue with multiple bundle and co

2019-07-08 20:14发布

问题:

I've a project with multiple bundles arranged per domain of activities in Symfony2.The project is running under the following domain one my local WAMP : Agapp.local with the following app/config/routing.yml

ag_app:
    resource: "@AgAppBundle/Resources/config/routing.yml"
    prefix:   /

ag_apsa:
    resource: "@AgApsaBundle/Resources/config/routing.yml"
    prefix:   /apsa

ag_training:
    resource: "@AgTrainingBundle/Resources/config/routing.yml"
    prefix:   /training

ag_intern:
    resource: "@AgInternBundle/Resources/config/routing.yml"
    prefix:   /parents/intern

ag_parents:
    resource: "@AgParentsBundle/Resources/config/routing.yml"
    prefix:   /parents

ag_circo:
    resource: "@AgCircoBundle/Resources/config/routing.yml"
    prefix:   /circo

ag_ecole:
    resource: "@AgEcoleBundle/Resources/config/routing.yml"
    prefix:   /ecole

The AgApsaBundle has the following main routing file:

ag_apsa_homepage:
    path:     /
    defaults: { _controller: AgrementApsaBundle:Apsa:index }

ag_apsa:
    resource: "@AgrementApsaBundle/Resources/config/routing/apsa.yml"
    prefix:   /

And here is the AgApsaBundle.yml content:

apsa:
   path:     /
   defaults: { _controller: "AgrementApsaBundle:Apsa:index" }

apsa_show:
    path:    /{id}/show
    defaults: { _controller: "AgApsaBundle:Apsa:show" }

apsa_new:
    path:     /new
    defaults: { _controller: "AgApsaBundle:Apsa:new" }

apsa_create:
    path:     /create
    defaults: { _controller: "AgApsaBundle:Apsa:create" }
    requirements: { _method: post }

apsa_edit:
    path:     /{id}/edit
    defaults: { _controller: "AgApsaBundle:Apsa:edit" }

apsa_update:
    path:     /{id}/update
    defaults: { _controller: "AgApsaBundle:Apsa:update" }
    requirements: { _method: post|put }

apsa_delete:
    path:    /{id}/delete
    defaults: { _controller: "AgApsaBundle:Apsa:delete" }
    requirements: { _method: post|delete }  

The AppKernel info :

new Ag\Metiers\Etab\EcoleBundle\AgEcoleBundle(), new Ag\Metiers\Etab\CircoBundle\AgCircoBundle(), new Ag\Metiers\Parents\ParentsBundle\AgParentsBundle(), new Ag\Metiers\Parents\InternBundle\AgInternBundle(), new Ag\Metiers\Training\TrainingBundle\AgTrainingBundle(), new Ag\Metiers\TrainingApsaBundle\AgApsaBundle(), new Ag\AppBundle\AgAppBundle(),

All the routes are well registered and listed ,as confirmed by the router:debug command. However, trying to access the AgApp.local/apsa or any other route related to the Apsa bundle, it returns a 'No data received Unable to load the webpage because the server sent no data.', while the log registers that a macthed route was found. On the opposite, trying a AgApp.local/apsa/parents will throw a 404 error.
You may find the log trace here

Am i missing something in the routing configuration?

回答1:

After , more research i found that the routes themselves were not the cause of the issue .But rather Doctrine, you can find the related question here