From 562832a540a6ed73bc05b45010c3cdf8b3e2b2ee Mon Sep 17 00:00:00 2001 From: Bozhidar Hristov Date: Tue, 14 Nov 2017 18:21:24 +0200 Subject: [PATCH 1/2] [FrameworkBundle] add documentation request context in Asset for use in console commands --- console/request_context.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/console/request_context.rst b/console/request_context.rst index b0983d270ed..2cd10c4ef4e 100644 --- a/console/request_context.rst +++ b/console/request_context.rst @@ -36,6 +36,7 @@ will override the defaults. router.request_context.host: example.org router.request_context.scheme: https router.request_context.base_url: my/path + asset.request_context.base_path: %router.request_context.base_url% .. code-block:: xml @@ -48,6 +49,7 @@ will override the defaults. example.org https my/path + %router.request_context.base_url% @@ -58,6 +60,7 @@ will override the defaults. $container->setParameter('router.request_context.host', 'example.org'); $container->setParameter('router.request_context.scheme', 'https'); $container->setParameter('router.request_context.base_url', 'my/path'); + $container->setParameter('asset.request_context.base_path', $container->getParameter('router.request_context.base_url')); Configuring the Request Context per Command ------------------------------------------- From e8d16d1279d2acf2fd16047c00369b936cc75a75 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 22 May 2018 16:37:46 +0200 Subject: [PATCH 2/2] Some rewording --- console/request_context.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/console/request_context.rst b/console/request_context.rst index 2cd10c4ef4e..26c2f69477f 100644 --- a/console/request_context.rst +++ b/console/request_context.rst @@ -21,8 +21,8 @@ Configuring the Request Context Globally To configure the Request Context - which is used by the URL Generator - you can redefine the parameters it uses as default values to change the default host -(localhost) and scheme (http). You can also configure the base path if Symfony -is not running in the root directory. +(localhost) and scheme (http). You can also configure the base path (both for +the URL generator and the assets) if Symfony is not running in the root directory. Note that this does not impact URLs generated via normal web requests, since those will override the defaults. @@ -37,6 +37,7 @@ will override the defaults. router.request_context.scheme: https router.request_context.base_url: my/path asset.request_context.base_path: %router.request_context.base_url% + asset.request_context.secure: true .. code-block:: xml @@ -50,6 +51,7 @@ will override the defaults. https my/path %router.request_context.base_url% + true @@ -61,6 +63,10 @@ will override the defaults. $container->setParameter('router.request_context.scheme', 'https'); $container->setParameter('router.request_context.base_url', 'my/path'); $container->setParameter('asset.request_context.base_path', $container->getParameter('router.request_context.base_url')); + $container->setParameter('asset.request_context.secure', true); + +.. versionadded:: 3.4 + The ``asset.request_context.*`` parameters were introduced in Symfony 3.4. Configuring the Request Context per Command -------------------------------------------