aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/EntriesExport.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/EntriesExport.php')
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php11
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;
8use Symfony\Component\Serializer\Serializer; 8use Symfony\Component\Serializer\Serializer;
9use Symfony\Component\Serializer\Encoder\XmlEncoder; 9use Symfony\Component\Serializer\Encoder\XmlEncoder;
10use Symfony\Component\Serializer\Encoder\JsonEncoder; 10use Symfony\Component\Serializer\Encoder\JsonEncoder;
11use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; 11use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
12use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
13use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
14use Doctrine\Common\Annotations\AnnotationReader;
12 15
13class EntriesExport 16class 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 /**