From 67b8ff28f0746f5ff441cae1c588253f92ee6138 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 13 Oct 2015 21:16:03 -0400 Subject: [PATCH 1/3] Tweaks - see #5314 --- components/config/definition.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index 1cfd366d986..0a769fd1fc3 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -212,6 +212,9 @@ Before defining the children of an array node, you can provide options like: ``addDefaultsIfNotSet()`` If any child nodes have default values, use them if explicit values haven't been provided. +``normalizeKeys(false)`` + If called (with ``false``), keys with dashes are *not* normaled to underscores. + It is recommended to use this to avoid this unnecessary normalization. A basic prototyped array configuration can be defined as follows:: @@ -310,6 +313,12 @@ The output configuration will be exactly the same as before. In other words, the ``sf_connection`` and ``default`` configuration keys are lost. The reason is that the Symfony Config component treats arrays as lists by default. +.. note:: + + As of writing this, there is an inconsistency: if only one file is processed, + the keys (i.e. ``sf_connection`` and ``default``) are *not* lost. But if more + than one file is processed, the keys are lost as described above. + In order to maintain the array keys use the ``useAttributeAsKey()`` method:: $node From 4e788e4204ea7cc0fad2e7d2185320bdaa8a131d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 13 Oct 2015 21:33:23 -0400 Subject: [PATCH 2/3] fixing build failure --- cookbook/event_dispatcher/event_listener.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/event_dispatcher/event_listener.rst b/cookbook/event_dispatcher/event_listener.rst index 3d50183110d..7ff3e3b2d2c 100644 --- a/cookbook/event_dispatcher/event_listener.rst +++ b/cookbook/event_dispatcher/event_listener.rst @@ -223,7 +223,7 @@ Request Events, Checking Types A single page can make several requests (one master request, and then multiple sub-requests - typically by :ref:`templating-embedding-controller`). For the core Symfony events, you might need to check to see if the event is for a "master" request -or a "sub request": +or a "sub request":: // src/AppBundle/EventListener/RequestListener.php namespace AppBundle\EventListener; From 51bc906ba6ea4b7db9ee6765944ac3e9fdef81e1 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 14 Oct 2015 20:49:50 -0400 Subject: [PATCH 3/3] Fixes thanks to Stof --- components/config/definition.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 0a769fd1fc3..9c69b9319bf 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -213,8 +213,9 @@ Before defining the children of an array node, you can provide options like: If any child nodes have default values, use them if explicit values haven't been provided. ``normalizeKeys(false)`` - If called (with ``false``), keys with dashes are *not* normaled to underscores. - It is recommended to use this to avoid this unnecessary normalization. + If called (with ``false``), keys with dashes are *not* normalized to underscores. + It is recommended to use this with prototype nodes where the user will define + a key-value map, to avoid an unnecessary transformation. A basic prototyped array configuration can be defined as follows:: @@ -315,9 +316,10 @@ the Symfony Config component treats arrays as lists by default. .. note:: - As of writing this, there is an inconsistency: if only one file is processed, - the keys (i.e. ``sf_connection`` and ``default``) are *not* lost. But if more - than one file is processed, the keys are lost as described above. + As of writing this, there is an inconsistency: if only one file provides the + configuration in question, the keys (i.e. ``sf_connection`` and ``default``) + are *not* lost. But if more than one file provides the configuration, the keys + are lost as described above. In order to maintain the array keys use the ``useAttributeAsKey()`` method::