From 4b1f8001792070963fba23cf0a2934ea8c713d61 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 6 Mar 2017 17:49:19 +0100 Subject: [PATCH] Added docs for castToArray() helper --- components/config/definition.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 4963df13bfe..59933695f47 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -190,6 +190,18 @@ inside the current node. According to the prototype definition in the example above, it is possible to have multiple connection arrays (containing a ``driver``, ``host``, etc.). +.. versionadded:: 3.3 + The ``castToArray()`` helper was added in Symfony 3.3. + +Sometimes, to improve the user experience of your application or bundle, you may +allow to use a simple string or numeric value where an array value is required. +Use the ``castToArray()`` helper to turn those variables into arrays:: + + ->arrayNode('hosts') + ->beforeNormalization()->castToArray()->end() + // ... + ->end() + Array Node Options ~~~~~~~~~~~~~~~~~~ @@ -750,8 +762,7 @@ A validation rule also requires a "then" part: - ``thenUnset()`` Usually, "then" is a closure. Its return value will be used as a new value -for the node, instead -of the node's original value. +for the node, instead of the node's original value. Processing Configuration Values -------------------------------