}
try {
- $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
+ $this->get('wallabag_core.content_proxy')->updateEntry(
$entry,
$url,
[
$this->validateUserAccess($entry->getUser()->getId());
try {
- $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
+ $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
/**
* Fetch content and update entry.
- * In case it fails, entry will return to avod loosing the data.
+ * In case it fails, $entry->getContent will return an error message.
*
* @param Entry $entry
* @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded
- *
- * @return Entry
*/
private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved')
{
$message = 'flashes.entry.notice.'.$prefixMessage;
try {
- $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
+ $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
}
$this->get('session')->getFlashBag()->add('notice', $message);
-
- return $entry;
}
/**
* @param Entry $entry Entry to update
* @param string $url Url to grab content for
* @param array $content An array with AT LEAST keys title, html, url to skip the fetchContent from the url
- *
- * @return Entry
*/
public function updateEntry(Entry $entry, $url, array $content = [])
{
'error_msg' => $e->getMessage(),
]);
}
-
- return $entry;
}
/**
* @param Entry $entry Entry to update
* @param string $url Url to grab content for
* @param array $content An array with AT LEAST keys title, html, url, language & content_type to skip the fetchContent from the url
- *
- * @return Entry
*/
protected function fetchContent(Entry $entry, $url, array $content = [])
{
try {
- return $this->contentProxy->updateEntry($entry, $url, $content);
+ $this->contentProxy->updateEntry($entry, $url, $content);
} catch (\Exception $e) {
return $entry;
}
$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->tagsAssigner->assignTagsToEntry(
$entry->setTitle($importedEntry['title']);
// update entry with content (in case fetching failed, the given entry will be return)
- $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry);
+ $this->fetchContent($entry, $importedEntry['url'], $importedEntry);
if (!empty($importedEntry['tags'])) {
$this->tagsAssigner->assignTagsToEntry(
$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 (!empty($data['tags'])) {
$this->tagsAssigner->assignTagsToEntry(
$entry->setUrl($url);
// update entry with content (in case fetching failed, the given entry will be return)
- $entry = $this->fetchContent($entry, $url);
+ $this->fetchContent($entry, $url);
// 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted
$entry->setArchived($importedEntry['status'] == 1 || $this->markAsRead);
$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);
$entry->setArchived($data['is_archived']);
$entry->setStarred($data['is_starred']);
$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->tagsAssigner->assignTagsToEntry(
]);
$proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80');
+ $entry = new Entry(new User());
+ $proxy->updateEntry($entry, 'http://user@:80');
$this->assertEquals('http://user@:80', $entry->getUrl());
$this->assertEmpty($entry->getTitle());
]);
$proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
+ $entry = new Entry(new User());
+ $proxy->updateEntry($entry, 'http://0.0.0.0');
$this->assertEquals('http://0.0.0.0', $entry->getUrl());
$this->assertEmpty($entry->getTitle());
]);
$proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io');
+ $entry = new Entry(new User());
+ $proxy->updateEntry($entry, 'http://domain.io');
$this->assertEquals('http://domain.io', $entry->getUrl());
$this->assertEquals('my title', $entry->getTitle());
]);
$proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
+ $entry = new Entry(new User());
+ $proxy->updateEntry($entry, 'http://0.0.0.0');
$this->assertEquals('http://1.1.1.1', $entry->getUrl());
$this->assertEquals('this is my title', $entry->getTitle());
->method('tag');
$proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(
- new Entry(new User()),
+ $entry = new Entry(new User());
+ $proxy->updateEntry(
+ $entry,
'http://0.0.0.0',
[
'html' => str_repeat('this is my content', 325),
->method('tag');
$proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(
- new Entry(new User()),
+ $entry = new Entry(new User());
+ $proxy->updateEntry(
+ $entry,
'http://0.0.0.0',
[
'html' => str_repeat('this is my content', 325),
$logger->pushHandler($handler);
$proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(
- new Entry(new User()),
+ $entry = new Entry(new User());
+ $proxy->updateEntry(
+ $entry,
'http://0.0.0.0',
[
'html' => str_repeat('this is my content', 325),
$proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
- $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [
+ $entry = new Entry(new User());
+ $proxy->updateEntry($entry, 'http://0.0.0.0', [
'html' => str_repeat('this is my content', 325),
'title' => 'this is my title',
'url' => 'http://1.1.1.1',