At the moment only Readability & wallabag v2 import allow created_at import.
Pocket removed `time_added` field from their API v2 to v3...
And wallabag v1 doesn't export that value.
}
/**
- * @return string
+ * Set created_at.
+ * Only used when importing data from an other service.
+ *
+ * @param DateTime $createdAt
+ *
+ * @return Entry
+ */
+ public function setCreatedAt(\DateTime $createdAt)
+ {
+ $this->createdAt = $createdAt;
+
+ return $this;
+ }
+
+ /**
+ * @return DateTime
*/
public function getCreatedAt()
{
}
/**
- * @return string
+ * @return DateTime
*/
public function getUpdatedAt()
{
$this->client = $client;
}
+ /**
+ * {@inheritdoc}
+ *
+ * @see https://getpocket.com/developer/docs/v3/retrieve
+ */
public function parseEntry(array $importedEntry)
{
$url = isset($importedEntry['resolved_url']) && $importedEntry['resolved_url'] != '' ? $importedEntry['resolved_url'] : $importedEntry['given_url'];
return true;
}
+ /**
+ * {@inheritdoc}
+ */
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
'language' => '',
'is_archived' => $importedEntry['archive'] || $this->markAsRead,
'is_starred' => $importedEntry['favorite'],
+ 'created_at' => $importedEntry['date_added'],
];
$entry = $this->fetchContent(
$entry->setArchived($data['is_archived']);
$entry->setStarred($data['is_starred']);
+ $entry->setCreatedAt(new \DateTime($data['created_at']));
$this->em->persist($entry);
++$this->importedEntries;
$entry->setArchived($data['is_archived']);
$entry->setStarred($data['is_starred']);
+ if (!empty($data['created_at'])) {
+ $entry->setCreatedAt(new \DateTime($data['created_at']));
+ }
+
$this->em->persist($entry);
++$this->importedEntries;
'is_archived' => $entry['is_read'] || $this->markAsRead,
'is_starred' => $entry['is_fav'],
'tags' => '',
+ 'created_at' => '',
];
// force content to be refreshed in case on bad fetch in the v1 installation
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.summary', $body[0]);
+
+ $this->assertNotEmpty($content->getMimetype());
+ $this->assertNotEmpty($content->getPreviewPicture());
+ $this->assertNotEmpty($content->getLanguage());
+ $this->assertEquals(0, count($content->getTags()));
+ $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
+ $this->assertEquals('2016-08-25', $content->getCreatedAt()->format('Y-m-d'));
}
public function testImportReadabilityWithFileAndMarkAllAsRead()
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.summary', $body[0]);
+
+ $this->assertEmpty($content->getMimetype());
+ $this->assertEmpty($content->getPreviewPicture());
+ $this->assertEmpty($content->getLanguage());
+ $this->assertEquals(1, count($content->getTags()));
+ $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
}
public function testImportWallabagWithFileAndMarkAllAsRead()
$this->assertNotEmpty($content->getPreviewPicture());
$this->assertNotEmpty($content->getLanguage());
$this->assertEquals(2, count($content->getTags()));
+ $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
+ $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
}
public function testImportWallabagWithEmptyFile()