$data = json_decode(file_get_contents($this->filepath), true);
if (empty($data)) {
+ $this->logger->error('WallabagImport: no entries in imported file');
+
return false;
}
return $this;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function validateEntry(array $importedEntry)
+ {
+ if (empty($importedEntry['url'])) {
+ return false;
+ }
+
+ return true;
+ }
+
/**
* {@inheritdoc}
*/
$entry->setTitle($data['title']);
// update entry with content (in case fetching failed, the given entry will be return)
- $entry = $this->fetchContent($entry, $data['url'], $data);
+ $this->fetchContent($entry, $data['url'], $data);
- if (array_key_exists('tags', $data)) {
- $this->contentProxy->assignTagsToEntry(
+ if (\array_key_exists('tags', $data)) {
+ $this->tagsAssigner->assignTagsToEntry(
$entry,
- $data['tags']
+ $data['tags'],
+ $this->em->getUnitOfWork()->getScheduledEntityInsertions()
);
}
$entry->setPreviewPicture($importedEntry['preview_picture']);
}
- $entry->setArchived($data['is_archived']);
+ $entry->updateArchived($data['is_archived']);
$entry->setStarred($data['is_starred']);
if (!empty($data['created_at'])) {