Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Routes Symfony上的条件路由_Routes_Symfony 1.4 - Fatal编程技术网

Routes Symfony上的条件路由

Routes Symfony上的条件路由,routes,symfony-1.4,Routes,Symfony 1.4,我们已经部署了一个Symfony应用程序,在该应用程序中,我们决定使用类似于organization.app name domain.com的URL来显示数据库中列出的组织的信息。为此,我们编写routing.yml如下: homepage: url: / class: sfDomainRoute param: { module: home, action: index } requirements: sf_host: [<?

我们已经部署了一个Symfony应用程序,在该应用程序中,我们决定使用类似于
organization.app name domain.com
的URL来显示数据库中列出的组织的信息。为此,我们编写routing.yml如下:

homepage:
     url:   /
     class: sfDomainRoute
     param: { module: home, action: index }
     requirements:
          sf_host: [<?php echo sfConfig::get('app_urlapp') ?>, www.<?php echo sfConfig::get('app_urlapp')."]\n" ?>

homepage_org:
     url:   /
     class: sfDomainRoute
     param: { module: org, action: show }
主页:
网址:/
类别:sfDomainRoute
参数:{module:home,action:index}
要求:
sf_主机:[,www。
主页和组织:
网址:/
类别:sfDomainRoute
参数:{module:org,action:show}
现在,我们正在另一个域中部署完全相同的应用程序,即第三个合作伙伴的子域。新的应用程序URL类似于
app name.partner domain.com

因此,我们不能让组织作为子域,不像以前那样

这不是一个大问题,我们可以将新应用程序的
路由.yml
更改为更常见的URL,如
app name.partner domain.com/organization
,但这对我来说不够顺畅,因为我们希望保持两个应用程序依赖于同一存储库等

我想到的可能解决方案是根据
app.yml
上定义的应用程序名称,在
frontendConfiguration.class.php
上手动路由。但我无法访问路由应用程序实例。
sfContext::getRoutes()
返回
null

我从Symfony 1.0中得到了创建条件路由的想法

你知道我们如何在Symfony 1.4上复制这些代码吗