Skip to content

Commit 69184cd

Browse files
committed
Various fixes.
1 parent dd300da commit 69184cd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

components/serializer.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ Assume you have the following object plain-old-PHP object::
160160
}
161161

162162
The definition of serialization can be specified using annotations, XML
163-
and YAML. The :class:Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
163+
or YAML. The :class:`Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory`
164164
that will be used by the normalizer must be aware of the format to use.
165165

166-
Initialize the :class:Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
166+
Initialize the :class:`Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory`
167167
like the following::
168168

169169
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
@@ -245,7 +245,12 @@ You are now able to serialize only attributes in the groups you want::
245245
$data = $serializer->normalize($obj, null, array('groups' => array('group1')));
246246
// $data = ['foo' => 'foo'];
247247

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+
);
249254
// $obj2 = MyObj(foo: 'foo', bar: 'bar')
250255

251256
.. _ignoring-attributes-when-serializing:
@@ -262,7 +267,8 @@ Ignoring Attributes
262267
2.7, they are ignored when deserializing too.
263268

264269
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`
266272
method on the normalizer definition::
267273

268274
use Symfony\Component\Serializer\Serializer;
@@ -450,7 +456,7 @@ having unique identifiers::
450456
.. seealso::
451457

452458
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).
454460

455461
.. _`JMS serializer`: https://github.com/schmittjoh/serializer
456462
.. _Packagist: https://packagist.org/packages/symfony/serializer

0 commit comments

Comments
 (0)