Skip to content

Updated routing articles to Symfony 4 #8657

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

Merged
merged 2 commits into from
Nov 17, 2017

Conversation

javiereguiluz
Copy link
Member

@javiereguiluz javiereguiluz commented Nov 14, 2017

This fixes #8656.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

What about promoting the controller: key config in YAML format?

@javiereguiluz
Copy link
Member Author

@yceruto that makes a lot of sense to me! Updated. Thanks.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks!

use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;

$collection = new RouteCollection();
$collection->add('contact', new Route(
'/contact', array(
'_controller' => 'AcmeDemoBundle:Main:contact',
'_controller' => 'App\Controller\DefaultController::contact',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's minor, and not worth delaying things because it's such a not important format, but in PHP, using the [DefaultController::class, 'contact'] is friendlier.

@weaverryan
Copy link
Member

Brilliant! That new controller: key is great!

@weaverryan weaverryan merged commit 419353b into symfony:master Nov 17, 2017
weaverryan added a commit that referenced this pull request Nov 17, 2017
This PR was squashed before being merged into the master branch (closes #8657).

Discussion
----------

Updated routing articles to Symfony 4

This fixes #8656.

Commits
-------

419353b Used the modern "controller" key in YAML routes
6d7415f Updated routing articles to Symfony 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update all routing/* articles to Symfony 4
4 participants