From 099f43158fdc604db68d0c622c0b800d321a16c4 Mon Sep 17 00:00:00 2001 From: Denis Rendler Date: Tue, 16 Feb 2016 18:05:18 +0200 Subject: [PATCH 1/3] [HttpFoundation] Fix typo for ParameterBag getters [HttpFoundation] Fix typo for max number of arguments for ParameterBag getters --- components/http_foundation/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 196f84d68ee..65587c2c274 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -140,7 +140,7 @@ has some methods to filter the input values: :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` Filters the parameter by using the PHP :phpfunction:`filter_var` function. -All getters takes up to three arguments: the first one is the parameter name +All getters take up to two arguments: the first one is the parameter name and the second one is the default value to return if the parameter does not exist:: From 70e749f06b11342ef59f5eb37ccd510a73b04c4a Mon Sep 17 00:00:00 2001 From: Denis Rendler Date: Wed, 17 Feb 2016 19:26:06 +0200 Subject: [PATCH 2/3] [HttpFoundation]Add missing doc for ParameterBag getter - Add missing doc for optional $deep ParameterBag getter - Set correct number of arguments back for versions up to 2.7 --- components/http_foundation/introduction.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 65587c2c274..2605fc7509a 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -140,9 +140,9 @@ has some methods to filter the input values: :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` Filters the parameter by using the PHP :phpfunction:`filter_var` function. -All getters take up to two arguments: the first one is the parameter name -and the second one is the default value to return if the parameter does not -exist:: +All getters take up to three arguments: the first one is the parameter name, +the second one is the default value to return if the parameter does not +exist and the third one is a boolean to allow for a deep search:: // the query string is '?foo=bar' @@ -154,6 +154,10 @@ exist:: $request->query->get('bar', 'bar'); // returns 'bar' + + //a path like foo[bar] will find deeper items + //the query string is '?foo[bar]=baz' + $request->query->get('foo[bar]', 'foobar', true); When PHP imports the request query, it handles request parameters like ``foo[bar]=bar`` in a special way as it creates an array. So you can get the From 697a87d8bd1a95e9dc63e97553a9176422415b07 Mon Sep 17 00:00:00 2001 From: Denis Rendler Date: Wed, 17 Feb 2016 21:54:15 +0200 Subject: [PATCH 3/3] [HttpFoundation]Revert the third param description Remove the unnecessary description for ParameterBag::get() third argument --- components/http_foundation/introduction.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 2605fc7509a..d8faf0c445f 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -140,9 +140,9 @@ has some methods to filter the input values: :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` Filters the parameter by using the PHP :phpfunction:`filter_var` function. -All getters take up to three arguments: the first one is the parameter name, +All getters take up to three arguments: the first one is the parameter name and the second one is the default value to return if the parameter does not -exist and the third one is a boolean to allow for a deep search:: +exist:: // the query string is '?foo=bar' @@ -155,9 +155,6 @@ exist and the third one is a boolean to allow for a deep search:: $request->query->get('bar', 'bar'); // returns 'bar' - //a path like foo[bar] will find deeper items - //the query string is '?foo[bar]=baz' - $request->query->get('foo[bar]', 'foobar', true); When PHP imports the request query, it handles request parameters like ``foo[bar]=bar`` in a special way as it creates an array. So you can get the