File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ You are now able to serialize only attributes in the groups you want::
337337 $normalizer = new ObjectNormalizer($classMetadataFactory);
338338 $serializer = new Serializer(array($normalizer));
339339
340- $data = $serializer->normalize($obj, null, array('groups' => array( 'group1') ));
340+ $data = $serializer->normalize($obj, null, array('groups' => 'group1'));
341341 // $data = array('foo' => 'foo');
342342
343343 $obj2 = $serializer->denormalize(
Original file line number Diff line number Diff line change @@ -130,9 +130,13 @@ to your class and choose which groups to use when serializing::
130130
131131 $json = $serializer->serialize(
132132 $someObject,
133- 'json', array('groups' => array( 'group1') )
133+ 'json', array('groups' => 'group1')
134134 );
135135
136+ .. note ::
137+
138+ The value of the ``groups `` key can be a single string, or an array of strings.
139+
136140In addition to the ``@Groups `` annotation, the Serializer component also
137141supports YAML or XML files. These files are automatically loaded when being
138142stored in one of the following locations:
You can’t perform that action at this time.
0 commit comments