diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index e073606c..f073ed7f 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -8,7 +8,10 @@ use Symfony\Component\HttpFoundation\Response; | |||
8 | use Symfony\Component\Serializer\Serializer; | 8 | use Symfony\Component\Serializer\Serializer; |
9 | use Symfony\Component\Serializer\Encoder\XmlEncoder; | 9 | use Symfony\Component\Serializer\Encoder\XmlEncoder; |
10 | use Symfony\Component\Serializer\Encoder\JsonEncoder; | 10 | use Symfony\Component\Serializer\Encoder\JsonEncoder; |
11 | use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; | 11 | use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; |
12 | use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; | ||
13 | use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; | ||
14 | use Doctrine\Common\Annotations\AnnotationReader; | ||
12 | 15 | ||
13 | class EntriesExport | 16 | class EntriesExport |
14 | { | 17 | { |
@@ -363,11 +366,11 @@ class EntriesExport | |||
363 | private function prepareSerializingContent($format) | 366 | private function prepareSerializingContent($format) |
364 | { | 367 | { |
365 | $encoders = array(new XmlEncoder(), new JsonEncoder()); | 368 | $encoders = array(new XmlEncoder(), new JsonEncoder()); |
366 | $normalizers = array(new ObjectNormalizer()); | 369 | $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); |
367 | $normalizers[0]->setIgnoredAttributes(array('user', 'createdAt', 'updatedAt')); | 370 | $normalizers = array(new PropertyNormalizer($classMetadataFactory)); |
368 | $serializer = new Serializer($normalizers, $encoders); | 371 | $serializer = new Serializer($normalizers, $encoders); |
369 | 372 | ||
370 | return $serializer->serialize($this->entries, $format); | 373 | return $serializer->serialize($this->entries, $format, array('groups' => array('entries_for_user'))); |
371 | } | 374 | } |
372 | 375 | ||
373 | /** | 376 | /** |