Skip to content

Commit d649179

Browse files
committed
[Serializer] Add CDATA_WRAPPING_NAME_PATTERN support to XmlEncoder
1 parent 33ea6e8 commit d649179

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

serializer/encoders.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ These are the options available on the :ref:`serializer context <serializer-cont
205205
``cdata_wrapping_pattern`` (default: ``/[<>&]/``)
206206
A regular expression pattern to determine if a value should be wrapped
207207
in a CDATA section.
208+
``cdata_wrapping_name_pattern`` (default: ``false``)
209+
A regular expression pattern that defines the names of fields whose values
210+
should always be wrapped in a CDATA section, even if their contents don't
211+
require it. Example: ``'/(firstname|lastname)/'``
208212
``ignore_empty_attributes`` (default: ``false``)
209213
If set to true, ignores all attributes with empty values in the generated XML
210214

@@ -216,6 +220,10 @@ These are the options available on the :ref:`serializer context <serializer-cont
216220

217221
The ``ignore_empty_attributes`` option was introduced in Symfony 7.3.
218222

223+
.. versionadded:: 7.4
224+
225+
The ``cdata_wrapping_name_pattern`` option was introduced in Symfony 7.4.
226+
219227
Example with a custom ``context``::
220228

221229
use Symfony\Component\Serializer\Encoder\XmlEncoder;

0 commit comments

Comments
 (0)