diff options
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 2 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 17 |
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; | |||
6 | use Doctrine\ORM\Mapping as ORM; | 6 | use Doctrine\ORM\Mapping as ORM; |
7 | use Symfony\Component\Validator\Constraints as Assert; | 7 | use Symfony\Component\Validator\Constraints as Assert; |
8 | use Hateoas\Configuration\Annotation as Hateoas; | 8 | use Hateoas\Configuration\Annotation as Hateoas; |
9 | use Symfony\Component\Serializer\Annotation\Groups; | 9 | use JMS\Serializer\Annotation\Groups; |
10 | use JMS\Serializer\Annotation\XmlRoot; | 10 | use JMS\Serializer\Annotation\XmlRoot; |
11 | use Wallabag\UserBundle\Entity\User; | 11 | use 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; | |||
5 | use PHPePub\Core\EPub; | 5 | use PHPePub\Core\EPub; |
6 | use PHPePub\Core\Structure\OPF\DublinCore; | 6 | use PHPePub\Core\Structure\OPF\DublinCore; |
7 | use Symfony\Component\HttpFoundation\Response; | 7 | use Symfony\Component\HttpFoundation\Response; |
8 | use Symfony\Component\Serializer\Serializer; | 8 | use JMS\Serializer; |
9 | use Symfony\Component\Serializer\Encoder\XmlEncoder; | 9 | use JMS\Serializer\SerializerBuilder; |
10 | use Symfony\Component\Serializer\Encoder\JsonEncoder; | 10 | use JMS\Serializer\SerializationContext; |
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; | ||
15 | 11 | ||
16 | class EntriesExport | 12 | class 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 | /** |