aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/EntriesExport.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-10-19 20:31:30 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2015-11-09 16:32:48 +0100
commit5b7da07620116a91d3c36ccd728d1899bc3ccb46 (patch)
tree1a342127fce008f517c193b9427f655ddae10540 /src/Wallabag/CoreBundle/Helper/EntriesExport.php
parent8ac95cbfcc2fa3e115bef369be216f7aa30f7311 (diff)
downloadwallabag-5b7da07620116a91d3c36ccd728d1899bc3ccb46.tar.gz
wallabag-5b7da07620116a91d3c36ccd728d1899bc3ccb46.tar.zst
wallabag-5b7da07620116a91d3c36ccd728d1899bc3ccb46.zip
use the groups annotation instead of setIgnoredAttributes
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 /**