将路由从旧格式迁移到新格式,相关文档在哪里?丢失的?

Migrating routes from old format to new one, where is the docs for this? Missing?

也许您最近从我之前的文章中注意到了 post 我正在开发 SF2。0.x 应用程序到新的 SF2.7。现在我有很多 NOTICE,它们不会影响应用程序功能,但它会影响,我想防止这种情况发生。我已阅读 Routing chapter at SF Book, The Routing Component and also @ Route and @Method 注释,但找不到任何有助于解决问题的信息。所以我需要这里的人的帮助。现在,路线如下所示(XML 格式):

<route id="PDOneBundle_repproject_process" path="/project/{page}/{action}">
    <default key="_controller">PDOneBundle:ProjectDetail:process</default>
    <requirement key="page">\w+</requirement>
    <requirement key="action">add|update|delete</requirement>
    <requirement key="_format">html</requirement>
    <requirement key="_method">POST|GET</requirement>
</route>

下面的消息是 NOTICE 我收到的是:

DEPRECATED - The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the setMethods() method instead or the "methods" option in the route definition.

现在定义路由的正确方法是什么?

你应该阅读这篇文章:

https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md

以及您搜索的部分:

Routing

    Some route settings have been renamed:
    The pattern setting for a route has been deprecated in favor of path
    The _scheme and _method requirements have been moved to the schemes and methods settings

Before:

article_edit:
   pattern: /article/{id}
   requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }

<route id="article_edit" pattern="/article/{id}">
   <requirement key="_method">POST|PUT</requirement>
   <requirement key="_scheme">https</requirement>
   <requirement key="id">\d+</requirement>
</route>

$route = new Route();
$route->setPattern('/article/{id}');
$route->setRequirement('_method', 'POST|PUT');
$route->setRequirement('_scheme', 'https');

After:

article_edit:
   path: /article/{id}
   methods: [POST, PUT]
   schemes: https
   requirements: { 'id': '\d+' }

<route id="article_edit" path="/article/{id}" methods="POST PUT" schemes="https">
   <requirement key="id">\d+</requirement>
</route>

$route = new Route();
$route->setPath('/article/{id}');
$route->setMethods(array('POST', 'PUT'));
$route->setSchemes('https');