File tree 2 files changed +14
-9
lines changed
Filter options
2 files changed +14
-9
lines changed
Original file line number Diff line number Diff line change @@ -277,12 +277,14 @@ If you're using the ``YamlFileLoader``, then route definitions look like this:
277
277
278
278
# routes.yaml
279
279
route1 :
280
- path : /foo
281
- defaults : { _controller: 'MyController::fooAction' }
280
+ path : /foo
281
+ controller : MyController::fooAction
282
+ methods : GET|HEAD
282
283
283
284
route2 :
284
- path : /foo/bar
285
- defaults : { _controller: 'MyController::foobarAction' }
285
+ path : /foo/bar
286
+ controller : FooBarInvokableController
287
+ methods : PUT
286
288
287
289
To load this file, you can use the following code. This assumes that your
288
290
``routes.yaml `` file is in the same directory as the below code::
Original file line number Diff line number Diff line change @@ -381,8 +381,8 @@ You can also set the host option on imported routes:
381
381
382
382
.. code-block :: php-annotations
383
383
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;
386
386
387
387
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
388
388
use Symfony\Component\Routing\Annotation\Route;
@@ -417,10 +417,13 @@ You can also set the host option on imported routes:
417
417
.. code-block :: php
418
418
419
419
// 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;
422
421
423
- return $routes;
422
+ return function (RoutingConfigurator $routes) {
423
+ $routes->import("@AcmeHelloBundle/Resources/config/routing.php")
424
+ ->host('hello.example.com')
425
+ ;
426
+ };
424
427
425
428
The host ``hello.example.com `` will be set on each route loaded from the new
426
429
routing resource.
You can’t perform that action at this time.
0 commit comments