We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
EnumNode
1 parent 15cddbe commit a2daec4Copy full SHA for a2daec4
components/config/definition.rst
@@ -186,6 +186,25 @@ The configuration can now be written like this::
186
->end()
187
;
188
189
+You can also use the ``enumClass()`` method to pass the FQCN of an enum
190
+class to the node. This will automatically set the values of the node to
191
+the cases of the enum::
192
+
193
+ $rootNode
194
+ ->children()
195
+ ->enumNode('delivery')
196
+ ->enumClass(Delivery::class)
197
+ ->end()
198
199
+ ;
200
201
+When using a backed enum, the values provided to the node will be casted
202
+to one of the enum cases if possible.
203
204
+.. versionadded:: 7.3
205
206
+ The ``enumClass()`` method was introduced in Symfony 7.3.
207
208
Array Nodes
209
~~~~~~~~~~~
210
0 commit comments