@@ -34,6 +34,8 @@ Configuration
34
34
* `gc_probability `_
35
35
* `gc_maxlifetime `_
36
36
* `save_path `_
37
+ * `serializer `_
38
+ * `enabled `_
37
39
* `templating `_
38
40
* `assets_base_urls `_
39
41
* `assets_version `_
@@ -244,6 +246,70 @@ save_path
244
246
This determines the argument to be passed to the save handler. If you choose
245
247
the default file handler, this is the path where the files are created.
246
248
249
+ .. _configuration-framework-serializer :
250
+
251
+ serializer
252
+ ~~~~~~~~~~
253
+
254
+ enabled
255
+ .......
256
+
257
+ **type **: ``boolean `` **default **: ``false ``
258
+
259
+ Whether to enable the ``serializer `` service or not in the service container.
260
+ If enabled, the ``serializer `` service will be available in the container
261
+ and will be loaded with two :ref: `encoders<component-serializer-encoders> `
262
+ (:class: `Symfony\\ Component\\ Serializer\\ Encoder\\ JsonEncoder ` and
263
+ :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ XmlEncoder `)
264
+ but no :ref: `normalizers<component-serializer-normalizers> `, meaning you'll
265
+ need to load your own.
266
+
267
+ You can load normalizers and/or encoders by tagging them as
268
+ :ref: `serializer.normalizer<reference-dic-tags-serializer-normalizer> ` and
269
+ :ref: `serializer.encoder<reference-dic-tags-serializer-encoder> `. It's also
270
+ possible to set the priority of the tag in order to decide the matching order.
271
+
272
+ Here an example on how to load the load
273
+ the :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer `:
274
+
275
+ .. configuration-block ::
276
+
277
+ .. code-block :: yaml
278
+
279
+ # app/config/config.yml
280
+ services :
281
+ get_set_method_normalizer :
282
+ class : Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer
283
+ tags :
284
+ - { name: serializer.normalizer }
285
+
286
+ .. code-block :: xml
287
+
288
+ <!-- app/config/config.xml -->
289
+ <services >
290
+ <service id =" get_set_method_normalizer" class =" Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer" >
291
+ <tag name =" serializer.normalizer" />
292
+ </service >
293
+ </services >
294
+
295
+ .. code-block :: php
296
+
297
+ // app/config/config.php
298
+ use Symfony\Component\DependencyInjection\Definition;
299
+
300
+ $definition = new Definition(
301
+ 'Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer'
302
+ ));
303
+ $definition->addTag('serializer.normalizer');
304
+ $container->setDefinition('get_set_method_normalizer', $definition);
305
+
306
+ .. note ::
307
+
308
+ The :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer `
309
+ is broken by design. As soon as you have a circular object graph, an
310
+ infinite loop is created when calling the getters. You're encouraged
311
+ to add your own normalizers that fit your use-case.
312
+
247
313
templating
248
314
~~~~~~~~~~
249
315
@@ -462,6 +528,10 @@ Full Default Configuration
462
528
# DEPRECATED! Please use: cookie_httponly
463
529
httponly : ~
464
530
531
+ # serializer configuration
532
+ serializer :
533
+ enabled : false
534
+
465
535
# templating configuration
466
536
templating :
467
537
assets_version : ~
0 commit comments