aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-10-19 21:17:30 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2015-11-09 16:32:48 +0100
commit268e9e7277d470dbd65b4eaa70c247ef35a95a3d (patch)
tree7667aec01d1b4989e89c54dbf79d895378d1f741
parent5b7da07620116a91d3c36ccd728d1899bc3ccb46 (diff)
downloadwallabag-268e9e7277d470dbd65b4eaa70c247ef35a95a3d.tar.gz
wallabag-268e9e7277d470dbd65b4eaa70c247ef35a95a3d.tar.zst
wallabag-268e9e7277d470dbd65b4eaa70c247ef35a95a3d.zip
use JMS Serializer
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php17
2 files changed, 6 insertions, 13 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index a2bb507e..5aa582f8 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM; 6use Doctrine\ORM\Mapping as ORM;
7use Symfony\Component\Validator\Constraints as Assert; 7use Symfony\Component\Validator\Constraints as Assert;
8use Hateoas\Configuration\Annotation as Hateoas; 8use Hateoas\Configuration\Annotation as Hateoas;
9use Symfony\Component\Serializer\Annotation\Groups; 9use JMS\Serializer\Annotation\Groups;
10use JMS\Serializer\Annotation\XmlRoot; 10use JMS\Serializer\Annotation\XmlRoot;
11use Wallabag\UserBundle\Entity\User; 11use Wallabag\UserBundle\Entity\User;
12 12
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index f073ed7f..c14f9d72 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -5,13 +5,9 @@ namespace Wallabag\CoreBundle\Helper;
5use PHPePub\Core\EPub; 5use PHPePub\Core\EPub;
6use PHPePub\Core\Structure\OPF\DublinCore; 6use PHPePub\Core\Structure\OPF\DublinCore;
7use Symfony\Component\HttpFoundation\Response; 7use Symfony\Component\HttpFoundation\Response;
8use Symfony\Component\Serializer\Serializer; 8use JMS\Serializer;
9use Symfony\Component\Serializer\Encoder\XmlEncoder; 9use JMS\Serializer\SerializerBuilder;
10use Symfony\Component\Serializer\Encoder\JsonEncoder; 10use JMS\Serializer\SerializationContext;
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;
15 11
16class EntriesExport 12class EntriesExport
17{ 13{
@@ -365,12 +361,9 @@ class EntriesExport
365 */ 361 */
366 private function prepareSerializingContent($format) 362 private function prepareSerializingContent($format)
367 { 363 {
368 $encoders = array(new XmlEncoder(), new JsonEncoder()); 364 $serializer = SerializerBuilder::create()->build();
369 $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
370 $normalizers = array(new PropertyNormalizer($classMetadataFactory));
371 $serializer = new Serializer($normalizers, $encoders);
372 365
373 return $serializer->serialize($this->entries, $format, array('groups' => array('entries_for_user'))); 366 return $serializer->serialize($this->entries, $format, SerializationContext::create()->setGroups(array('entries_for_user')));
374 } 367 }
375 368
376 /** 369 /**