Skip to content

Commit 6dfd966

Browse files
committed
minor #8653 [FrameworkBundle] add documentation request context in Asset for use … (Bozhidar Hristov, javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] add documentation request context in Asset for use … Add Asset Request Context in documentation for generating urls in console. Commits ------- e8d16d1 Some rewording 562832a [FrameworkBundle] add documentation request context in Asset for use in console commands
2 parents 771db44 + e8d16d1 commit 6dfd966

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

console/request_context.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Configuring the Request Context Globally
2121

2222
To configure the Request Context - which is used by the URL Generator - you can
2323
redefine the parameters it uses as default values to change the default host
24-
(localhost) and scheme (http). You can also configure the base path if Symfony
25-
is not running in the root directory.
24+
(localhost) and scheme (http). You can also configure the base path (both for
25+
the URL generator and the assets) if Symfony is not running in the root directory.
2626

2727
Note that this does not impact URLs generated via normal web requests, since those
2828
will override the defaults.
@@ -36,6 +36,8 @@ will override the defaults.
3636
router.request_context.host: example.org
3737
router.request_context.scheme: https
3838
router.request_context.base_url: my/path
39+
asset.request_context.base_path: %router.request_context.base_url%
40+
asset.request_context.secure: true
3941
4042
.. code-block:: xml
4143
@@ -48,6 +50,8 @@ will override the defaults.
4850
<parameter key="router.request_context.host">example.org</parameter>
4951
<parameter key="router.request_context.scheme">https</parameter>
5052
<parameter key="router.request_context.base_url">my/path</parameter>
53+
<parameter key="asset.request_context.base_path">%router.request_context.base_url%</parameter>
54+
<parameter key="asset.request_context.secure">true</parameter>
5155
</parameters>
5256
5357
</container>
@@ -58,6 +62,11 @@ will override the defaults.
5862
$container->setParameter('router.request_context.host', 'example.org');
5963
$container->setParameter('router.request_context.scheme', 'https');
6064
$container->setParameter('router.request_context.base_url', 'my/path');
65+
$container->setParameter('asset.request_context.base_path', $container->getParameter('router.request_context.base_url'));
66+
$container->setParameter('asset.request_context.secure', true);
67+
68+
.. versionadded:: 3.4
69+
The ``asset.request_context.*`` parameters were introduced in Symfony 3.4.
6170

6271
Configuring the Request Context per Command
6372
-------------------------------------------

0 commit comments

Comments
 (0)