1
1
.. index ::
2
2
single: Config; Defining and processing configuration values
3
3
4
- Defining and processing configuration values
4
+ Defining and Processing Configuration Values
5
5
============================================
6
6
7
- Validating configuration values
7
+ Validating Configuration Values
8
8
-------------------------------
9
9
10
10
After loading configuration values from all kinds of resources, the values
@@ -38,7 +38,7 @@ they are when first encountered. Also, some keys are only available when
38
38
another key has a specific value (in the sample configuration above: the
39
39
``memory `` key only makes sense when the ``driver `` is ``sqlite ``).
40
40
41
- Defining a hierarchy of configuration values using the TreeBuilder
41
+ Defining a Hierarchy of Configuration Values Using the TreeBuilder
42
42
------------------------------------------------------------------
43
43
44
44
All the rules concerning configuration values can be defined using the
@@ -66,10 +66,10 @@ should be returned from a custom ``Configuration`` class which implements the
66
66
}
67
67
}
68
68
69
- Adding node definitions to the tree
69
+ Adding Node Definitions to the Tree
70
70
-----------------------------------
71
71
72
- Variable nodes
72
+ Variable Nodes
73
73
~~~~~~~~~~~~~~
74
74
75
75
A tree contains node definitions which can be laid out in a semantic way.
@@ -91,7 +91,7 @@ The root node itself is an array node, and has children, like the boolean
91
91
node ``auto_connect `` and the scalar node ``default_connection ``. In general:
92
92
after defining a node, a call to ``end() `` takes you one step up in the hierarchy.
93
93
94
- Node type
94
+ Node Type
95
95
~~~~~~~~~
96
96
97
97
It is possible to validate the type of a provided value by using the appropriate
@@ -108,7 +108,7 @@ node definition. Node type are available for:
108
108
and are created with ``node($name, $type) `` or their associated shortcut
109
109
``xxxxNode($name) `` method.
110
110
111
- Numeric node constraints
111
+ Numeric Node Constraints
112
112
~~~~~~~~~~~~~~~~~~~~~~~~
113
113
114
114
Numeric nodes (float and integer) provide two extra constraints -
@@ -130,7 +130,7 @@ allowing to validate the value::
130
130
->end()
131
131
;
132
132
133
- Enum nodes
133
+ Enum Nodes
134
134
~~~~~~~~~~
135
135
136
136
Enum nodes provide a constraint to match the given input against a set of
@@ -146,7 +146,7 @@ values::
146
146
147
147
This will restrict the ``gender `` option to be either ``male `` or ``female ``.
148
148
149
- Array nodes
149
+ Array Nodes
150
150
~~~~~~~~~~~
151
151
152
152
It is possible to add a deeper level to the hierarchy, by adding an array
@@ -187,7 +187,7 @@ inside the current node. According to the prototype definition in the example
187
187
above, it is possible to have multiple connection arrays (containing a ``driver ``,
188
188
``host ``, etc.).
189
189
190
- Array node options
190
+ Array Node Options
191
191
~~~~~~~~~~~~~~~~~~
192
192
193
193
Before defining the children of an array node, you can provide options like:
@@ -230,7 +230,7 @@ In XML, each ``parameters`` node would have a ``name`` attribute (along with
230
230
the final array. The ``useAttributeAsKey `` is useful for normalizing how
231
231
arrays are specified between different formats like XML and YAML.
232
232
233
- Default and required values
233
+ Default and required Values
234
234
---------------------------
235
235
236
236
For all node types, it is possible to define default values and replacement
@@ -307,7 +307,7 @@ you can take advantage of the shortcut
307
307
The ``canBeDisabled `` method looks about the same except that the section
308
308
would be enabled by default.
309
309
310
- Merging options
310
+ Merging Options
311
311
---------------
312
312
313
313
Extra options concerning the merge process may be provided. For arrays:
@@ -321,7 +321,7 @@ For all nodes:
321
321
``cannotBeOverwritten() ``
322
322
don’t let other configuration arrays overwrite an existing value for this node
323
323
324
- Appending sections
324
+ Appending Sections
325
325
------------------
326
326
327
327
If you have a complex configuration to validate then the tree can grow to
@@ -493,7 +493,7 @@ By changing a string value into an associative array with ``name`` as the key::
493
493
->end()
494
494
;
495
495
496
- Validation rules
496
+ Validation Rules
497
497
----------------
498
498
499
499
More advanced validation rules can be provided using the
@@ -539,7 +539,7 @@ Usually, "then" is a closure. Its return value will be used as a new value
539
539
for the node, instead
540
540
of the node's original value.
541
541
542
- Processing configuration values
542
+ Processing Configuration Values
543
543
-------------------------------
544
544
545
545
The :class: `Symfony\\ Component\\ Config\\ Definition\\ Processor ` uses the tree
0 commit comments