From 676dff12e30b366c2953c0386bf8628f5c6644b4 Mon Sep 17 00:00:00 2001 From: Jeanmonod David Date: Thu, 20 Sep 2012 07:15:52 +0200 Subject: [PATCH 1/2] Documentation of the new numerical type handling --- components/config/definition.rst | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index cc2a610ef08..6999a0f7809 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -74,7 +74,7 @@ Variable nodes A tree contains node definitions which can be laid out in a semantic way. This means, using indentation and the fluent notation, it is possible to -reflect the real structure of the configuration values:: +reflect the real structure of the configuration values: $rootNode ->children() @@ -100,11 +100,39 @@ node definition. Node type are available for: * scalar * boolean * array +* enum (new in 2.1) +* integer (new in 2.2) +* float (new in 2.2) * variable (no validation) and are created with ``node($name, $type)`` or their associated shortcut ``xxxxNode($name)`` method. +Numeric node constraints +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.2 + + The numeric (float and integer) nodes are new in 2.2 + +Numeric node (float and integer) provide two extra constraints min() and max() allowing to validate the value: + +.. code-block:: php + + $rootNode + ->children() + ->integerNode('positive_value') + ->min(0) + ->end() + ->floatNode('big_value') + ->max(5E45) + ->end() + ->integerNode('value_inside_a_range') + ->min(-50)->max(50) + ->end() + ->end() + ; + Array nodes ~~~~~~~~~~~ From e95632caa3622c16a6501b5e5b2e98710a0d6b4c Mon Sep 17 00:00:00 2001 From: Jeanmonod David Date: Thu, 20 Sep 2012 23:55:54 +0200 Subject: [PATCH 2/2] Syntax fixes --- components/config/definition.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 6999a0f7809..a38dca3d262 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -74,7 +74,7 @@ Variable nodes A tree contains node definitions which can be laid out in a semantic way. This means, using indentation and the fluent notation, it is possible to -reflect the real structure of the configuration values: +reflect the real structure of the configuration values:: $rootNode ->children() @@ -106,7 +106,7 @@ node definition. Node type are available for: * variable (no validation) and are created with ``node($name, $type)`` or their associated shortcut -``xxxxNode($name)`` method. + ``xxxxNode($name)`` method. Numeric node constraints ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -115,7 +115,8 @@ Numeric node constraints The numeric (float and integer) nodes are new in 2.2 -Numeric node (float and integer) provide two extra constraints min() and max() allowing to validate the value: +Numeric node (float and integer) provide two extra constraints min() and + max() allowing to validate the value: .. code-block:: php