Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.4] Completion for PHP-based configuration for routes #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Haehnchen opened this issue Oct 9, 2017 · 1 comment
Open

[3.4] Completion for PHP-based configuration for routes #1042

Haehnchen opened this issue Oct 9, 2017 · 1 comment

Comments

@Haehnchen
Copy link
Owner

Haehnchen commented Oct 9, 2017

return function (RoutingConfigurator $routes) {
    // import routes defined in a separate file
    $routes->import('legacy_routes.php')
        ->prefix('/legacy')
    ;

    // define the routes using a "fluent interface"
    $routes
        ->add('product', '/products/{id}')
            ->controller('App\Controller\ProductController::show')
            ->schemes(['https'])
            ->requirements(['id' => '\d+'])
            ->defaults(['id' => 0])

        ->add('homepage', '/')
            ->controller('App\Controller\DefaultController::index')
    ;
};

Global References provider needed for invoke

\Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator::__invoke
\Symfony\Component\DependencyInjection\Loader\Configurator\ParametersConfigurator::__invoke

https://symfony.com/blog/new-in-symfony-3-4-php-based-configuration-for-services-and-routes
symfony/symfony#24180

@TavoNiievez
Copy link

@Haehnchen is this planned or should i migrate to yaml/xml?
I would like to define the routes in a centralized file, but losing the IDE help in the PHP format is a big missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants