それがどのように機能するかを見たいです。特に、「_」で展開を実行している場合、または渡したパラメーターに基づいて同等のキーをルーティングで検索している場合。
ドキュメント、ネット、およびコードベースを検索しましたが、それがどこにあるかについての情報はあまりありません。symfonyのドキュメントは、リンクを構築するときにそれを使用します。
{# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #}
<form action="{{ path('task_new') }}" method="post" {{ form_enctype(form) }}>
{{ form_widget(form) }}
<input type="submit" />
</form>
ルーティングファイルのキーを使用しているようです。したがって、次のコード:
{{ path('_welcome') }}
ルーティングで「_welcome」のキーを持つルーティングを探します。
yaml
_welcome:
pattern: /
defaults: { _controller: AcmeDemoBundle:Main:homepage }
php
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$collection = new RouteCollection();
$collection->add('_welcome', new Route('/', array(
'_controller' => 'AcmeDemoBundle:Main:homepage',
)));
return $collection;