0

在更新包含一些新路由的应用程序后,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 ?>)
4

1 回答 1

0

您需要路线的culture参数:change_language

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

也许也符合您的要求。

于 2012-04-19T15:07:12.703 回答