File tree 2 files changed +6
-2
lines changed
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::
337
337
$normalizer = new ObjectNormalizer($classMetadataFactory);
338
338
$serializer = new Serializer(array($normalizer));
339
339
340
- $data = $serializer->normalize($obj, null, array('groups' => array( 'group1') ));
340
+ $data = $serializer->normalize($obj, null, array('groups' => 'group1'));
341
341
// $data = array('foo' => 'foo');
342
342
343
343
$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::
130
130
131
131
$json = $serializer->serialize(
132
132
$someObject,
133
- 'json', array('groups' => array( 'group1') )
133
+ 'json', array('groups' => 'group1')
134
134
);
135
135
136
+ .. note ::
137
+
138
+ The value of the ``groups `` key can be a single string, or an array of strings.
139
+
136
140
In addition to the ``@Groups `` annotation, the Serializer component also
137
141
supports YAML or XML files. These files are automatically loaded when being
138
142
stored in one of the following locations:
You can’t perform that action at this time.
0 commit comments