From: Thomas Citharel Date: Mon, 19 Oct 2015 19:17:30 +0000 (+0200) Subject: use JMS Serializer X-Git-Tag: 2.0.0-alpha.1~14^2~3 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=268e9e7277d470dbd65b4eaa70c247ef35a95a3d;hp=5b7da07620116a91d3c36ccd728d1899bc3ccb46;p=github%2Fwallabag%2Fwallabag.git use JMS Serializer --- 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; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Hateoas\Configuration\Annotation as Hateoas; -use Symfony\Component\Serializer\Annotation\Groups; +use JMS\Serializer\Annotation\Groups; use JMS\Serializer\Annotation\XmlRoot; use Wallabag\UserBundle\Entity\User; 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; use PHPePub\Core\EPub; use PHPePub\Core\Structure\OPF\DublinCore; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Serializer\Serializer; -use Symfony\Component\Serializer\Encoder\XmlEncoder; -use Symfony\Component\Serializer\Encoder\JsonEncoder; -use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; -use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; -use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; -use Doctrine\Common\Annotations\AnnotationReader; +use JMS\Serializer; +use JMS\Serializer\SerializerBuilder; +use JMS\Serializer\SerializationContext; class EntriesExport { @@ -365,12 +361,9 @@ class EntriesExport */ private function prepareSerializingContent($format) { - $encoders = array(new XmlEncoder(), new JsonEncoder()); - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); - $normalizers = array(new PropertyNormalizer($classMetadataFactory)); - $serializer = new Serializer($normalizers, $encoders); + $serializer = SerializerBuilder::create()->build(); - return $serializer->serialize($this->entries, $format, array('groups' => array('entries_for_user'))); + return $serializer->serialize($this->entries, $format, SerializationContext::create()->setGroups(array('entries_for_user'))); } /**