3 namespace Wallabag\ImportBundle\Import
;
5 use Wallabag\CoreBundle\Entity\Entry
;
7 class WallabagV2Import
extends WallabagV1Import
implements ImportInterface
12 public function getName()
20 public function getUrl()
22 return 'import_wallabag_v2';
28 public function getDescription()
30 return 'import.wallabag_v2.description';
36 protected function parseEntries($entries)
40 foreach ($entries as $importedEntry) {
41 $existingEntry = $this->em
42 ->getRepository('WallabagCoreBundle:Entry')
43 ->findByUrlAndUserId($importedEntry['url'], $this->user
->getId());
45 if (false !== $existingEntry) {
46 ++
$this->skippedEntries
;
50 $importedEntry['html'] = $importedEntry['content'];
51 $importedEntry['content_type'] = $importedEntry['mimetype'];
53 $entry = $this->contentProxy
->updateEntry(
54 new Entry($this->user
),
55 $importedEntry['url'],
59 if (array_key_exists('tags', $importedEntry) && !empty($importedEntry['tags'])) {
60 $this->contentProxy
->assignTagsToEntry(
62 $importedEntry['tags']
66 if (isset($importedEntry['preview_picture'])) {
67 $entry->setPreviewPicture($importedEntry['preview_picture']);
70 $entry->setArchived($importedEntry['is_archived'] || $this->markAsRead
);
71 $entry->setStarred($importedEntry['is_starred']);
73 $this->em
->persist($entry);
74 ++
$this->importedEntries
;
76 // flush every 20 entries
77 if (($i %
20) === 0) {