mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Add originUrl property to Entry, handle that in EntryRestController, handle migration
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
e585dde46c
commit
e0ef1a1c8b
3 changed files with 99 additions and 0 deletions
|
@ -309,6 +309,7 @@ class EntryRestController extends WallabagRestController
|
|||
* {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
|
||||
* {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
|
||||
* {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
|
||||
* {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry."},
|
||||
* }
|
||||
* )
|
||||
*
|
||||
|
@ -368,6 +369,10 @@ class EntryRestController extends WallabagRestController
|
|||
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
|
||||
}
|
||||
|
||||
if (!empty($data['origin_url'])) {
|
||||
$entry->setOriginUrl($data['origin_url']);
|
||||
}
|
||||
|
||||
if (null !== $data['isPublic']) {
|
||||
if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
|
||||
$entry->generateUid();
|
||||
|
@ -404,6 +409,7 @@ class EntryRestController extends WallabagRestController
|
|||
* {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
|
||||
* {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
|
||||
* {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
|
||||
* {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry."},
|
||||
* }
|
||||
* )
|
||||
*
|
||||
|
@ -480,6 +486,10 @@ class EntryRestController extends WallabagRestController
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($data['origin_url'])) {
|
||||
$entry->setOriginUrl($data['origin_url']);
|
||||
}
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
@ -778,6 +788,7 @@ class EntryRestController extends WallabagRestController
|
|||
'picture' => $request->request->get('preview_picture'),
|
||||
'publishedAt' => $request->request->get('published_at'),
|
||||
'authors' => $request->request->get('authors', ''),
|
||||
'origin_url' => $request->request->get('origin_url', ''),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue