aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-10-07 13:55:55 +0200
committerGitHub <noreply@github.com>2016-10-07 13:55:55 +0200
commitbf71a734f64a911549e188a5c69ac8e08eec896e (patch)
tree0e40afc2a85658705fdf4a1a6b8e7c6c3d7dfbc3 /src/Wallabag
parent9d127b3b9365c73bc393bc303545f24c159cee31 (diff)
parent74e1f7433a5fc0a9bbf3942a22917e0dd1cc6923 (diff)
downloadwallabag-bf71a734f64a911549e188a5c69ac8e08eec896e.tar.gz
wallabag-bf71a734f64a911549e188a5c69ac8e08eec896e.tar.zst
wallabag-bf71a734f64a911549e188a5c69ac8e08eec896e.zip
Merge pull request #2332 from wallabag/tags-export
Fix relations export for Entry
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/AnnotationBundle/Entity/Annotation.php7
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php4
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php17
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php13
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml2
15 files changed, 41 insertions, 22 deletions
diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php
index 90ee7c2d..c48d8731 100644
--- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php
+++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php
@@ -7,6 +7,7 @@ use JMS\Serializer\Annotation\ExclusionPolicy;
7use JMS\Serializer\Annotation\Exclude; 7use JMS\Serializer\Annotation\Exclude;
8use JMS\Serializer\Annotation\VirtualProperty; 8use JMS\Serializer\Annotation\VirtualProperty;
9use JMS\Serializer\Annotation\SerializedName; 9use JMS\Serializer\Annotation\SerializedName;
10use JMS\Serializer\Annotation\Groups;
10use Wallabag\UserBundle\Entity\User; 11use Wallabag\UserBundle\Entity\User;
11use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
12 13
@@ -33,6 +34,8 @@ class Annotation
33 * @var string 34 * @var string
34 * 35 *
35 * @ORM\Column(name="text", type="text") 36 * @ORM\Column(name="text", type="text")
37 *
38 * @Groups({"entries_for_user", "export_all"})
36 */ 39 */
37 private $text; 40 private $text;
38 41
@@ -54,6 +57,8 @@ class Annotation
54 * @var string 57 * @var string
55 * 58 *
56 * @ORM\Column(name="quote", type="string") 59 * @ORM\Column(name="quote", type="string")
60 *
61 * @Groups({"entries_for_user", "export_all"})
57 */ 62 */
58 private $quote; 63 private $quote;
59 64
@@ -61,6 +66,8 @@ class Annotation
61 * @var array 66 * @var array
62 * 67 *
63 * @ORM\Column(name="ranges", type="array") 68 * @ORM\Column(name="ranges", type="array")
69 *
70 * @Groups({"entries_for_user", "export_all"})
64 */ 71 */
65 private $ranges; 72 private $ranges;
66 73
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
index 6c6a331a..fedad009 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
@@ -23,6 +23,9 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
23 $entry1->setContent('This is my content /o/'); 23 $entry1->setContent('This is my content /o/');
24 $entry1->setLanguage('en'); 24 $entry1->setLanguage('en');
25 25
26 $entry1->addTag($this->getReference('foo-tag'));
27 $entry1->addTag($this->getReference('baz-tag'));
28
26 $manager->persist($entry1); 29 $manager->persist($entry1);
27 30
28 $this->addReference('entry1', $entry1); 31 $this->addReference('entry1', $entry1);
@@ -96,6 +99,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
96 $entry6->setContent('This is my content /o/'); 99 $entry6->setContent('This is my content /o/');
97 $entry6->setArchived(true); 100 $entry6->setArchived(true);
98 $entry6->setLanguage('de'); 101 $entry6->setLanguage('de');
102 $entry6->addTag($this->getReference('bar-tag'));
99 103
100 $manager->persist($entry6); 104 $manager->persist($entry6);
101 105
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index a4b0d7a8..f2da3f4d 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -196,8 +196,6 @@ class Entry
196 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id") 196 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
197 * } 197 * }
198 * ) 198 * )
199 *
200 * @Groups({"entries_for_user", "export_all"})
201 */ 199 */
202 private $tags; 200 private $tags;
203 201
@@ -542,6 +540,21 @@ class Entry
542 } 540 }
543 541
544 /** 542 /**
543 * @VirtualProperty
544 * @SerializedName("tags")
545 * @Groups({"entries_for_user", "export_all"})
546 */
547 public function getSerializedTags()
548 {
549 $data = [];
550 foreach ($this->tags as $tag) {
551 $data[] = $tag->getLabel();
552 }
553
554 return $data;
555 }
556
557 /**
545 * @param Tag $tag 558 * @param Tag $tag
546 */ 559 */
547 public function addTag(Tag $tag) 560 public function addTag(Tag $tag)
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 0c627dcd..e50c68a6 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -21,7 +21,6 @@ class EntriesExport
21 private $entries = []; 21 private $entries = [];
22 private $authors = ['wallabag']; 22 private $authors = ['wallabag'];
23 private $language = ''; 23 private $language = '';
24 private $tags = [];
25 private $footerTemplate = '<div style="text-align:center;"> 24 private $footerTemplate = '<div style="text-align:center;">
26 <p>Produced by wallabag with %EXPORT_METHOD%</p> 25 <p>Produced by wallabag with %EXPORT_METHOD%</p>
27 <p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p> 26 <p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p>
@@ -53,10 +52,6 @@ class EntriesExport
53 52
54 $this->entries = $entries; 53 $this->entries = $entries;
55 54
56 foreach ($entries as $entry) {
57 $this->tags[] = $entry->getTags();
58 }
59
60 return $this; 55 return $this;
61 } 56 }
62 57
@@ -159,8 +154,8 @@ class EntriesExport
159 154
160 // set tags as subjects 155 // set tags as subjects
161 foreach ($this->entries as $entry) { 156 foreach ($this->entries as $entry) {
162 foreach ($this->tags as $tag) { 157 foreach ($entry->getTags() as $tag) {
163 $book->setSubject($tag['value']); 158 $book->setSubject($tag->getLabel());
164 } 159 }
165 160
166 // the reader in Kobo Devices doesn't likes special caracters 161 // the reader in Kobo Devices doesn't likes special caracters
@@ -265,8 +260,8 @@ class EntriesExport
265 * Adding actual entries 260 * Adding actual entries
266 */ 261 */
267 foreach ($this->entries as $entry) { 262 foreach ($this->entries as $entry) {
268 foreach ($this->tags as $tag) { 263 foreach ($entry->getTags() as $tag) {
269 $pdf->SetKeywords($tag['value']); 264 $pdf->SetKeywords($tag->getLabel());
270 } 265 }
271 266
272 $pdf->AddPage(); 267 $pdf->AddPage();
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 40644ff5..b04b9512 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -462,7 +462,7 @@ flashes:
462 # entry_saved_failed: 'Entry saved but fetching content failed' 462 # entry_saved_failed: 'Entry saved but fetching content failed'
463 # entry_updated: 'Entry updated' 463 # entry_updated: 'Entry updated'
464 # entry_reloaded: 'Entry reloaded' 464 # entry_reloaded: 'Entry reloaded'
465 # entry_reload_failed: 'Entry reloaded but fetching content failed' 465 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
466 entry_archived: 'Artikel arkiveret' 466 entry_archived: 'Artikel arkiveret'
467 entry_unarchived: 'Artikel ikke længere arkiveret' 467 entry_unarchived: 'Artikel ikke længere arkiveret'
468 entry_starred: 'Artikel markeret som favorit' 468 entry_starred: 'Artikel markeret som favorit'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 130ab2cd..6ea3f5c5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -462,7 +462,7 @@ flashes:
462 entry_saved_failed: 'Eintrag gespeichert, aber das Abrufen des Inhalts ist fehlgeschlagen' 462 entry_saved_failed: 'Eintrag gespeichert, aber das Abrufen des Inhalts ist fehlgeschlagen'
463 entry_updated: 'Eintrag aktualisiert' 463 entry_updated: 'Eintrag aktualisiert'
464 entry_reloaded: 'Eintrag neugeladen' 464 entry_reloaded: 'Eintrag neugeladen'
465 entry_reload_failed: 'Eintrag neugeladen, aber das Abrufen des Inhalts ist fehlgeschlagen' 465 entry_reloaded_failed: 'Eintrag neugeladen, aber das Abrufen des Inhalts ist fehlgeschlagen'
466 entry_archived: 'Artikel archiviert' 466 entry_archived: 'Artikel archiviert'
467 entry_unarchived: 'Artikel dearchiviert' 467 entry_unarchived: 'Artikel dearchiviert'
468 entry_starred: 'Artikel favorisiert' 468 entry_starred: 'Artikel favorisiert'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 91abe162..38631e24 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -461,7 +461,7 @@ flashes:
461 entry_saved_failed: 'Entry saved but fetching content failed' 461 entry_saved_failed: 'Entry saved but fetching content failed'
462 entry_updated: 'Entry updated' 462 entry_updated: 'Entry updated'
463 entry_reloaded: 'Entry reloaded' 463 entry_reloaded: 'Entry reloaded'
464 entry_reload_failed: 'Entry reloaded but fetching content failed' 464 entry_reloaded_failed: 'Entry reloaded but fetching content failed'
465 entry_archived: 'Entry archived' 465 entry_archived: 'Entry archived'
466 entry_unarchived: 'Entry unarchived' 466 entry_unarchived: 'Entry unarchived'
467 entry_starred: 'Entry starred' 467 entry_starred: 'Entry starred'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 25d2f3a2..a1fc34ef 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -462,7 +462,7 @@ flashes:
462 # entry_saved_failed: 'Entry saved but fetching content failed' 462 # entry_saved_failed: 'Entry saved but fetching content failed'
463 entry_updated: 'Entrada actualizada' 463 entry_updated: 'Entrada actualizada'
464 entry_reloaded: 'Entrada recargada' 464 entry_reloaded: 'Entrada recargada'
465 # entry_reload_failed: 'Entry reloaded but fetching content failed' 465 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
466 entry_archived: 'Artículo archivado' 466 entry_archived: 'Artículo archivado'
467 entry_unarchived: 'Artículo desarchivado' 467 entry_unarchived: 'Artículo desarchivado'
468 entry_starred: 'Artículo guardado en los favoritos' 468 entry_starred: 'Artículo guardado en los favoritos'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index b02ffea0..740302c5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -461,7 +461,7 @@ flashes:
461 # entry_saved_failed: 'Entry saved but fetching content failed' 461 # entry_saved_failed: 'Entry saved but fetching content failed'
462 entry_updated: 'مقاله به‌روز شد' 462 entry_updated: 'مقاله به‌روز شد'
463 entry_reloaded: 'مقاله به‌روز شد' 463 entry_reloaded: 'مقاله به‌روز شد'
464 # entry_reload_failed: 'Entry reloaded but fetching content failed' 464 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
465 entry_archived: 'مقاله بایگانی شد' 465 entry_archived: 'مقاله بایگانی شد'
466 entry_unarchived: 'مقاله از بایگانی درآمد' 466 entry_unarchived: 'مقاله از بایگانی درآمد'
467 entry_starred: 'مقاله برگزیده شد' 467 entry_starred: 'مقاله برگزیده شد'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 598205b0..ad4fc99f 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -462,7 +462,7 @@ flashes:
462 entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu' 462 entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu'
463 entry_updated: 'Article mis à jour' 463 entry_updated: 'Article mis à jour'
464 entry_reloaded: 'Article rechargé' 464 entry_reloaded: 'Article rechargé'
465 entry_reload_failed: "Article mis à jour mais impossible de récupérer le contenu" 465 entry_reloaded_failed: "Article mis à jour mais impossible de récupérer le contenu"
466 entry_archived: 'Article marqué comme lu' 466 entry_archived: 'Article marqué comme lu'
467 entry_unarchived: 'Article marqué comme non lu' 467 entry_unarchived: 'Article marqué comme non lu'
468 entry_starred: 'Article ajouté dans les favoris' 468 entry_starred: 'Article ajouté dans les favoris'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index c58c929f..e0bd9d8b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -462,7 +462,7 @@ flashes:
462 # entry_saved_failed: 'Entry saved but fetching content failed' 462 # entry_saved_failed: 'Entry saved but fetching content failed'
463 entry_updated: 'Contenuto aggiornato' 463 entry_updated: 'Contenuto aggiornato'
464 entry_reloaded: 'Contenuto ricaricato' 464 entry_reloaded: 'Contenuto ricaricato'
465 # entry_reload_failed: 'Entry reloaded but fetching content failed' 465 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
466 entry_archived: 'Contenuto archiviato' 466 entry_archived: 'Contenuto archiviato'
467 entry_unarchived: 'Contenuto dis-archiviato' 467 entry_unarchived: 'Contenuto dis-archiviato'
468 entry_starred: 'Contenuto segnato come preferito' 468 entry_starred: 'Contenuto segnato come preferito'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 8f06434d..b26bed87 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -462,7 +462,7 @@ flashes:
462 entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut' 462 entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut'
463 entry_updated: 'Article mes a jorn' 463 entry_updated: 'Article mes a jorn'
464 entry_reloaded: 'Article recargat' 464 entry_reloaded: 'Article recargat'
465 entry_reload_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat" 465 entry_reloaded_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat"
466 entry_archived: 'Article marcat coma legit' 466 entry_archived: 'Article marcat coma legit'
467 entry_unarchived: 'Article marcat coma pas legit' 467 entry_unarchived: 'Article marcat coma pas legit'
468 entry_starred: 'Article apondut dins los favorits' 468 entry_starred: 'Article apondut dins los favorits'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 7f28e648..285d73e5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -462,7 +462,7 @@ flashes:
462 entry_saved_failed: 'Wpis zapisany, ale wystąpił bład pobierania treści' 462 entry_saved_failed: 'Wpis zapisany, ale wystąpił bład pobierania treści'
463 entry_updated: 'Wpis zaktualizowany' 463 entry_updated: 'Wpis zaktualizowany'
464 entry_reloaded: 'Wpis ponownie załadowany' 464 entry_reloaded: 'Wpis ponownie załadowany'
465 entry_reload_failed: 'Wpis ponownie załadowany, ale wystąpił bład pobierania treści' 465 entry_reloaded_failed: 'Wpis ponownie załadowany, ale wystąpił bład pobierania treści'
466 entry_archived: 'Wpis dodany do archiwum' 466 entry_archived: 'Wpis dodany do archiwum'
467 entry_unarchived: 'Wpis usunięty z archiwum' 467 entry_unarchived: 'Wpis usunięty z archiwum'
468 entry_starred: 'Wpis oznaczony gwiazdką' 468 entry_starred: 'Wpis oznaczony gwiazdką'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 4e0e454c..fba6f998 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -462,7 +462,7 @@ flashes:
462 # entry_saved_failed: 'Entry saved but fetching content failed' 462 # entry_saved_failed: 'Entry saved but fetching content failed'
463 # entry_updated: 'Entry updated' 463 # entry_updated: 'Entry updated'
464 # entry_reloaded: 'Entry reloaded' 464 # entry_reloaded: 'Entry reloaded'
465 # entry_reload_failed: 'Entry reloaded but fetching content failed' 465 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
466 entry_archived: 'Articol arhivat' 466 entry_archived: 'Articol arhivat'
467 entry_unarchived: 'Articol dezarhivat' 467 entry_unarchived: 'Articol dezarhivat'
468 entry_starred: 'Articol adăugat la favorite' 468 entry_starred: 'Articol adăugat la favorite'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 02b3aae6..1694e212 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -461,7 +461,7 @@ flashes:
461 # entry_saved_failed: 'Entry saved but fetching content failed' 461 # entry_saved_failed: 'Entry saved but fetching content failed'
462 # entry_updated: 'Entry updated' 462 # entry_updated: 'Entry updated'
463 entry_reloaded: 'Makale içeriği yenilendi' 463 entry_reloaded: 'Makale içeriği yenilendi'
464 # entry_reload_failed: 'Entry reloaded but fetching content failed' 464 # entry_reloaded_failed: 'Entry reloaded but fetching content failed'
465 entry_archived: 'Makale arşivlendi' 465 entry_archived: 'Makale arşivlendi'
466 entry_unarchived: 'Makale arşivden çıkartıldı' 466 entry_unarchived: 'Makale arşivden çıkartıldı'
467 entry_starred: 'Makale favorilere eklendi' 467 entry_starred: 'Makale favorilere eklendi'