Skip to content

Commit 73ff3cc

Browse files
cdfreweaverryan
authored andcommitted
Corrention of wrong code example. The request service is not available in Commandline (CLI) - You cannot create a service ("request") of an inactive scope
1 parent 455cd00 commit 73ff3cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

book/routing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,11 +1116,11 @@ method:
11161116
the current ``Request`` object. This is detected automatically based
11171117
on server information supplied by PHP. When generating absolute URLs for
11181118
scripts run from the command line, you'll need to manually set the desired
1119-
host on the ``Request`` object:
1119+
host on the ``RequestContext`` object:
11201120

11211121
.. code-block:: php
11221122
1123-
$request->headers->set('HOST', 'www.example.com');
1123+
$router->getContext()->setHost('www.example.com');
11241124
11251125
.. index::
11261126
single: Routing; Generating URLs in a template

0 commit comments

Comments
 (0)