Skip to content

Commit

Permalink
minor #5787 Definition Tweaks - see #5314 (weaverryan)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

Definition Tweaks - see #5314

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | n/a

See #5314 - I am quite a novice with the Configuration component :).

Commits
-------

51bc906 Fixes thanks to Stof
4e788e4 fixing build failure
67b8ff2 Tweaks - see #5314
  • Loading branch information
weaverryan committed Oct 15, 2015
2 parents 4d04ccf + 51bc906 commit b2a9a6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ 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* 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::

Expand Down Expand Up @@ -310,6 +314,13 @@ 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 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::

$node
Expand Down
2 changes: 1 addition & 1 deletion cookbook/event_dispatcher/event_listener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b2a9a6c

Please sign in to comment.