Symfony不匹配/找到任何路线

时间:2012-04-19 14:22:19

标签: symfony1 routing symfony-1.4

更新包含一些新路线的应用程序后,symfony无法匹配任何路线:

symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'changeLanguage',  'module' => 'language',  'culture' => 'en_US',)"

我需要做些什么才能让symfony再次查找/匹配路由?

所以这是我的路线 routing.yml中

<?php $cultures = implode(I18NUtils::availableCultures(), '|') ?>

locality_list:
  url:  /:sf_culture/orte/:slug.:season.:id.:sf_format
  class: sfPropelRoute
  options: { model: Locality, type: object }
  param: { module: locality, action: list, sf_format: html }
  requirements:
    id: \d+
    sf_method: [get]

locality_info:
  url:  /:sf_culture/orte/:slug.:season.:id.details.:sf_format
  class: sfPropelRoute
  options: { model: Locality, type: object }
  param: { module: locality, action: show, sf_format: html }
  requirements:
    id: \d+
    sf_method: [get]

housings_by_category:
  url:  /:sf_culture/category/:slugs
  param: { module: housing, action: listByCategory, sf_format: html }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

housings_by_tag_locality:
  url:  /:sf_culture/tag/:tags/:locality_id
  param: { module: housing, action: listByTag, sf_format: html }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

housings_by_tag:
  url:  /:sf_culture/tag/:tags
  param: { module: housing, action: listByTag, sf_format: html }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

housings_by_locality:
  url:  /:sf_culture/:slug.:season.:id.list.:sf_format
  class: sfPropelRoute
  options: { model: Locality, type: object }
  param: { module: housing, action: list, sf_format: html }
  requirements:
    id: \d+
    sf_method: [get]

housing_info:
  url:  /:sf_culture/:slug.:season.:id.:sf_format
  class: sfPropelRoute
  options: { model: Housing, type: object }
  param: { module: housing, action: show, sf_format: html }
  requirements:
    id: \d+
    sf_method: [get]

housings:
  url: /:sf_culture/
  param: { module: housing, action: index }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

hut_details:
  url:  /:sf_culture/huetten/:slug.:season.:id.:sf_format
  class: sfPropelRoute
  options: { model: Housing, type: object }
  param: { module: housing, action: show, sf_format: html }
  requirements:
    id: \d+
    sf_method: [get]

huts:
  url: /:sf_culture/huetten
  param: { module: hut, action: index }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

legacy_redirect:
  url: /incoming/:action/*
  param: { module: legacysite, sf_format: html }

home:
  url:  /
  param: { module: home, action: index }

localized_home:
    url:    /:sf_culture/
    param:  { module: home, action: index  }
    requirements:
        sf_culture: (?:<?php echo $cultures ?>)

change_language:
    url:    /language
    param:  { module: language, action: changeLanguage }

# default rules
default_index:
  url:   /:sf_culture/:module
  param: { action: index }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

default:
  url:   /:sf_culture/:module/:action/*
  param: { sf_format: html }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

1 个答案:

答案 0 :(得分:0)

您的culture路线需要change_language参数:

change_language:
    url:    /language/:culture
    param:  { module: language, action: changeLanguage }

也许符合您的要求。