Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing][i18n] Wrong PHP format example #10762

Closed
@fsevestre

Description

@fsevestre

Hello,

There are some issues in the PHP format example (https://github.com/symfony/symfony-docs/blame/e350b3efcfadbb26ab51768e5f6a2bcb07d9dc14/routing.rst#L260) which don't generate the same result as the YAML or the XML formats examples.


# config/routes/annotations.yamlcontrollers:resource:../../src/Controller/type:annotationprefix:en:''# don't prefix URLs for English, the default localenl:'/nl'it:'/it'
// var/cache/dev/srcApp_KernelDevDebugContainerUrlMatcher<?phpuseSymfony\Component\Routing\Matcher\Dumper\PhpMatcherTrait;useSymfony\Component\Routing\RequestContext;/** * This class has been auto-generated * by the Symfony Routing Component. */class srcApp_KernelDevDebugContainerUrlMatcherextendsSymfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher{use PhpMatcherTrait;publicfunction__construct(RequestContext$context)    {$this->context =$context;$this->staticRoutes =array('/' =>array(array(array('_route' =>'app_default_index','_controller' =>'App\\Controller\\DefaultController::index','_locale' =>'en'),null,null,null,false,null)),'/nl' =>array(array(array('_route' =>'app_default_index','_controller' =>'App\\Controller\\DefaultController::index','_locale' =>'nl'),null,null,null,true,null)),'/it' =>array(array(array('_route' =>'app_default_index','_controller' =>'App\\Controller\\DefaultController::index','_locale' =>'it'),null,null,null,true,null)),'/test' =>array(array(array('_route' =>'app_default_index2','_controller' =>'App\\Controller\\DefaultController::index2','_locale' =>'en'),null,null,null,false,null)),'/nl/test' =>array(array(array('_route' =>'app_default_index2','_controller' =>'App\\Controller\\DefaultController::index2','_locale' =>'nl'),null,null,null,false,null)),'/it/test' =>array(array(array('_route' =>'app_default_index2','_controller' =>'App\\Controller\\DefaultController::index2','_locale' =>'it'),null,null,null,false,null)),        );$this->regexpList =array(0 =>'{^(?'                    .'|/_error/(\\d+)(?:\\.([^/]++))?(*:35)'                .')(?:/?)$}sDu',        );$this->dynamicRoutes =array(35 =>array(array(array('_route' =>'_twig_error_test','_controller' =>'twig.controller.preview_error::previewErrorPageAction','_format' =>'html'),array('code','_format'),null,null,false,null)),        );    }}
php bin/console debug:router ----------------------- -------- -------- ------ --------------------------   Name                    Method   Scheme   Host   Path                       ----------------------- -------- -------- ------ --------------------------   app_default_index.en    ANY      ANY      ANY    /                           app_default_index.nl    ANY      ANY      ANY    /nl/                        app_default_index.it    ANY      ANY      ANY    /it/                        app_default_index2.en   ANY      ANY      ANY    /test                       app_default_index2.nl   ANY      ANY      ANY    /nl/test                    app_default_index2.it   ANY      ANY      ANY    /it/test                    _twig_error_test        ANY      ANY      ANY    /_error/{code}.{_format}   ----------------------- -------- -------- ------ --------------------------

// config/routes/annotations.php<?phpuseSymfony\Component\Routing\RouteCollection;/** @var RouteCollection $routes */$routes =$loader->import('../../src/Controller/','annotation');$routes->addPrefix('/',array('_locale' =>'en'));$routes->addPrefix('/nl',array('_locale' =>'nl'));$routes->addPrefix('/it',array('_locale' =>'it'));return$routes;
// var/cache/dev/srcApp_KernelDevDebugContainerUrlMatcher<?phpuseSymfony\Component\Routing\Matcher\Dumper\PhpMatcherTrait;useSymfony\Component\Routing\RequestContext;/** * This class has been auto-generated * by the Symfony Routing Component. */class srcApp_KernelDevDebugContainerUrlMatcherextendsSymfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher{use PhpMatcherTrait;publicfunction__construct(RequestContext$context)    {$this->context =$context;$this->staticRoutes =array('/it/nl' =>array(array(array('_route' =>'app_default_index','_controller' =>'App\\Controller\\DefaultController::index','_locale' =>'it'),null,null,null,true,null)),'/it/nl/test' =>array(array(array('_route' =>'app_default_index2','_controller' =>'App\\Controller\\DefaultController::index2','_locale' =>'it'),null,null,null,false,null)),        );$this->regexpList =array(0 =>'{^(?'                    .'|/_error/(\\d+)(?:\\.([^/]++))?(*:35)'                .')(?:/?)$}sDu',        );$this->dynamicRoutes =array(35 =>array(array(array('_route' =>'_twig_error_test','_controller' =>'twig.controller.preview_error::previewErrorPageAction','_format' =>'html'),array('code','_format'),null,null,false,null)),        );    }}
php bin/console debug:router -------------------- -------- -------- ------ --------------------------   Name                 Method   Scheme   Host   Path                       -------------------- -------- -------- ------ --------------------------   app_default_index    ANY      ANY      ANY    /it/nl/                     app_default_index2   ANY      ANY      ANY    /it/nl/test                 _twig_error_test     ANY      ANY      ANY    /_error/{code}.{_format}   -------------------- -------- -------- ------ --------------------------

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp