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
.. versionadded :: 2.2
@@ -133,7 +133,7 @@ allowing to validate the value::
133
133
->end()
134
134
;
135
135
136
- Enum nodes
136
+ Enum Nodes
137
137
~~~~~~~~~~
138
138
139
139
.. versionadded :: 2.1
@@ -152,7 +152,7 @@ values::
152
152
153
153
This will restrict the ``gender `` option to be either ``male `` or ``female ``.
154
154
155
- Array nodes
155
+ Array Nodes
156
156
~~~~~~~~~~~
157
157
158
158
It is possible to add a deeper level to the hierarchy, by adding an array
@@ -193,7 +193,7 @@ inside the current node. According to the prototype definition in the example
193
193
above, it is possible to have multiple connection arrays (containing a ``driver ``,
194
194
``host ``, etc.).
195
195
196
- Array node options
196
+ Array Node Options
197
197
~~~~~~~~~~~~~~~~~~
198
198
199
199
Before defining the children of an array node, you can provide options like:
@@ -236,7 +236,7 @@ In XML, each ``parameters`` node would have a ``name`` attribute (along with
236
236
the final array. The ``useAttributeAsKey `` is useful for normalizing how
237
237
arrays are specified between different formats like XML and YAML.
238
238
239
- Default and required values
239
+ Default and required Values
240
240
---------------------------
241
241
242
242
For all node types, it is possible to define default values and replacement
@@ -316,7 +316,7 @@ you can take advantage of the shortcut
316
316
The ``canBeDisabled `` method looks about the same except that the section
317
317
would be enabled by default.
318
318
319
- Merging options
319
+ Merging Options
320
320
---------------
321
321
322
322
Extra options concerning the merge process may be provided. For arrays:
@@ -330,7 +330,7 @@ For all nodes:
330
330
``cannotBeOverwritten() ``
331
331
don’t let other configuration arrays overwrite an existing value for this node
332
332
333
- Appending sections
333
+ Appending Sections
334
334
------------------
335
335
336
336
If you have a complex configuration to validate then the tree can grow to
@@ -502,7 +502,7 @@ By changing a string value into an associative array with ``name`` as the key::
502
502
->end()
503
503
;
504
504
505
- Validation rules
505
+ Validation Rules
506
506
----------------
507
507
508
508
More advanced validation rules can be provided using the
@@ -548,7 +548,7 @@ Usually, "then" is a closure. Its return value will be used as a new value
548
548
for the node, instead
549
549
of the node's original value.
550
550
551
- Processing configuration values
551
+ Processing Configuration Values
552
552
-------------------------------
553
553
554
554
The :class: `Symfony\\ Component\\ Config\\ Definition\\ Processor ` uses the tree
0 commit comments