File tree 2 files changed +18
-2
lines changed
Filter options
2 files changed +18
-2
lines changed
Original file line number Diff line number Diff line change @@ -2743,6 +2743,18 @@ paths
2743
2743
This option allows to define an array of paths with files or directories where
2744
2744
the component will look for additional serialization files.
2745
2745
2746
+ default_context
2747
+ ...............
2748
+
2749
+ **type **: ``array `` **default **: ``[] ``
2750
+
2751
+ A map with default context options that will be used with each ``serialize `` and ``deserialize ``
2752
+ call. This can be used for example to set the json encoding behavior by setting ``json_encode_options ``
2753
+ to a `json_encode flags bitmask `_.
2754
+
2755
+ You can inspect the :ref: `serializer context builders <serializer-using-context-builders >`
2756
+ to discover the available settings.
2757
+
2746
2758
php_errors
2747
2759
~~~~~~~~~~
2748
2760
@@ -3573,6 +3585,7 @@ use the configuration of the first exception that matches ``instanceof``:
3573
3585
.. _`blue/green deployment` : https://martinfowler.com/bliki/BlueGreenDeployment.html
3574
3586
.. _`gulp-rev` : https://www.npmjs.com/package/gulp-rev
3575
3587
.. _`webpack-manifest-plugin` : https://www.npmjs.com/package/webpack-manifest-plugin
3588
+ .. _`json_encode flags bitmask` : https://www.php.net/json_encode
3576
3589
.. _`error_reporting PHP option` : https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
3577
3590
.. _`CSRF security attacks` : https://en.wikipedia.org/wiki/Cross-site_request_forgery
3578
3591
.. _`session.sid_length PHP option` : https://www.php.net/manual/session.configuration.php#ini.session.sid-length
Original file line number Diff line number Diff line change @@ -130,14 +130,15 @@ configuration:
130
130
serializer :
131
131
default_context :
132
132
enable_max_depth : true
133
+ yaml_indentation : 2
133
134
134
135
.. code-block :: xml
135
136
136
137
<!-- config/packages/framework.xml -->
137
138
<framework : config >
138
139
<!-- ... -->
139
140
<framework : serializer >
140
- <default-context enable-max-depth =" true" />
141
+ <default-context enable-max-depth =" true" yaml-indentation = " 2 " />
141
142
</framework : serializer >
142
143
</framework : config >
143
144
@@ -146,11 +147,13 @@ configuration:
146
147
// config/packages/framework.php
147
148
use Symfony\Config\FrameworkConfig;
148
149
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
150
+ use Symfony\Component\Serializer\Encoder\YamlEncoder;
149
151
150
152
return static function (FrameworkConfig $framework) {
151
153
$framework->serializer()
152
154
->defaultContext([
153
- AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true
155
+ AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
156
+ YamlEncoder::YAML_INDENTATION => 2,
154
157
])
155
158
;
156
159
};
You can’t perform that action at this time.
0 commit comments