@@ -160,10 +160,10 @@ Assume you have the following object plain-old-PHP object::
160
160
}
161
161
162
162
The definition of serialization can be specified using annotations, XML
163
- and YAML. The :class: Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
163
+ or YAML. The :class: ` Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory `
164
164
that will be used by the normalizer must be aware of the format to use.
165
165
166
- Initialize the :class: Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
166
+ Initialize the :class: ` Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory `
167
167
like the following::
168
168
169
169
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
@@ -245,7 +245,12 @@ You are now able to serialize only attributes in the groups you want::
245
245
$data = $serializer->normalize($obj, null, array('groups' => array('group1')));
246
246
// $data = ['foo' => 'foo'];
247
247
248
- $obj2 = $serializer->denormalize(array('foo' => 'foo', 'bar' => 'bar'), 'MyObj', null, array('groups' => array('group1', 'group3')));
248
+ $obj2 = $serializer->denormalize(
249
+ array('foo' => 'foo', 'bar' => 'bar'),
250
+ 'MyObj',
251
+ null,
252
+ array('groups' => array('group1', 'group3'))
253
+ );
249
254
// $obj2 = MyObj(foo: 'foo', bar: 'bar')
250
255
251
256
.. _ignoring-attributes-when-serializing :
@@ -262,7 +267,8 @@ Ignoring Attributes
262
267
2.7, they are ignored when deserializing too.
263
268
264
269
As an option, there's a way to ignore attributes from the origin object. To remove
265
- those attributes use the :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer::setIgnoredAttributes `
270
+ those attributes use the
271
+ :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer::setIgnoredAttributes `
266
272
method on the normalizer definition::
267
273
268
274
use Symfony\Component\Serializer\Serializer;
@@ -450,7 +456,7 @@ having unique identifiers::
450
456
.. seealso ::
451
457
452
458
A popular alternative to the Symfony Serializer Component is the third-party
453
- library, `JMS serializer `_.
459
+ library, `JMS serializer `_ (released under the Apache license, so incompatible with GPLv2 projects) .
454
460
455
461
.. _`JMS serializer` : https://github.com/schmittjoh/serializer
456
462
.. _Packagist : https://packagist.org/packages/symfony/serializer
0 commit comments