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

Appearance settings

Commit 802244d

Browse filesBrowse files
author
Jules Pietri
committed
Some route fixes left after #11085
1 parent bf1c431 commit 802244d
Copy full SHA for 802244d

File tree

2 files changed

+14
-9
lines changed
Filter options

2 files changed

+14
-9
lines changed

‎components/routing.rst

Copy file name to clipboardExpand all lines: components/routing.rst
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,14 @@ If you're using the ``YamlFileLoader``, then route definitions look like this:
277277
278278
# routes.yaml
279279
route1:
280-
path: /foo
281-
defaults: { _controller: 'MyController::fooAction' }
280+
path: /foo
281+
controller: MyController::fooAction
282+
methods: GET|HEAD
282283
283284
route2:
284-
path: /foo/bar
285-
defaults: { _controller: 'MyController::foobarAction' }
285+
path: /foo/bar
286+
controller: FooBarInvokableController
287+
methods: PUT
286288
287289
To load this file, you can use the following code. This assumes that your
288290
``routes.yaml`` file is in the same directory as the below code::

‎routing/hostname_pattern.rst

Copy file name to clipboardExpand all lines: routing/hostname_pattern.rst
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ You can also set the host option on imported routes:
381381

382382
.. code-block:: php-annotations
383383
384-
// src/Controller/MainController.php
385-
namespace Acme\HelloBundle\Controller;
384+
// vendor/acme/acme-hello-bundle/src/Controller/MainController.php
385+
namespace Acme\AcmeHelloBundle\Controller;
386386
387387
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
388388
use Symfony\Component\Routing\Annotation\Route;
@@ -417,10 +417,13 @@ You can also set the host option on imported routes:
417417
.. code-block:: php
418418
419419
// config/routes.php
420-
$routes = $loader->import("@AcmeHelloBundle/Resources/config/routing.php");
421-
$routes->setHost('hello.example.com');
420+
namespace Symfony\Component\Routing\Loader\Configurator;
422421
423-
return $routes;
422+
return function (RoutingConfigurator $routes) {
423+
$routes->import("@AcmeHelloBundle/Resources/config/routing.php")
424+
->host('hello.example.com')
425+
;
426+
};
424427
425428
The host ``hello.example.com`` will be set on each route loaded from the new
426429
routing resource.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.