具有多个捆绑和配置级别的Symfony2路由问题

时间:2015-12-14 13:38:28

标签: symfony routing routes

我在Symfony2中为每个活动域安排了一个包含多个包的项目。该项目在以下域中运行,一个是我的本地WAMP:Agapp.local,其中包含以下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

AgApsaBundle具有以下主要路由文件:

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

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

以下是AgApsaBundle.yml内容:

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 }  

AppKernel信息:

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(),

router:debug命令确认,所有路由都已正确注册并列出。 但是,尝试访问与{Apsa捆绑包相关的AgApp.local/apsa或任何其他路由时,它会返回“未收到数据无法加载网页,因为服务器未发送任何数据。”日志记录发现了一条已修改的路由。相反,尝试AgApp.local/apsa/parents会抛出404错误 您可以找到日志跟踪here

我是否遗漏了路由配置中的内容?

1 个答案:

答案 0 :(得分:0)

之后,我发现更多的研究发现路线本身不是问题的原因。但相当于学说,你可以找到相关的问题here