aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-11-20 21:10:33 +0100
committerGitHub <noreply@github.com>2017-11-20 21:10:33 +0100
commitf4f7994c40ca57c7e6f8ca0a3d298c50c4e5f813 (patch)
tree14b2c8f8ea61578a7ca0c5414a85ce29bcf57bd7 /src/Wallabag/ApiBundle
parent16b1939827453bc1c8f65c908c45575d27134a53 (diff)
parenteae8138b33e4ed4a5d1a98daf77941ef691629de (diff)
downloadwallabag-f4f7994c40ca57c7e6f8ca0a3d298c50c4e5f813.tar.gz
wallabag-f4f7994c40ca57c7e6f8ca0a3d298c50c4e5f813.tar.zst
wallabag-f4f7994c40ca57c7e6f8ca0a3d298c50c4e5f813.zip
Merge pull request #3346 from Kdecherf/origin-property
Add originUrl property to Entry
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index 6f161a08..7d820c7e 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -309,6 +309,7 @@ class EntryRestController extends WallabagRestController
309 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"}, 309 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
310 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"}, 310 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
311 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, 311 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
312 * {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry (from where you found it)."},
312 * } 313 * }
313 * ) 314 * )
314 * 315 *
@@ -368,6 +369,10 @@ class EntryRestController extends WallabagRestController
368 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']); 369 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
369 } 370 }
370 371
372 if (!empty($data['origin_url'])) {
373 $entry->setOriginUrl($data['origin_url']);
374 }
375
371 if (null !== $data['isPublic']) { 376 if (null !== $data['isPublic']) {
372 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) { 377 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
373 $entry->generateUid(); 378 $entry->generateUid();
@@ -404,6 +409,7 @@ class EntryRestController extends WallabagRestController
404 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"}, 409 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
405 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"}, 410 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
406 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, 411 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
412 * {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry (from where you found it)."},
407 * } 413 * }
408 * ) 414 * )
409 * 415 *
@@ -480,6 +486,10 @@ class EntryRestController extends WallabagRestController
480 } 486 }
481 } 487 }
482 488
489 if (!empty($data['origin_url'])) {
490 $entry->setOriginUrl($data['origin_url']);
491 }
492
483 $em = $this->getDoctrine()->getManager(); 493 $em = $this->getDoctrine()->getManager();
484 $em->persist($entry); 494 $em->persist($entry);
485 $em->flush(); 495 $em->flush();
@@ -778,6 +788,7 @@ class EntryRestController extends WallabagRestController
778 'picture' => $request->request->get('preview_picture'), 788 'picture' => $request->request->get('preview_picture'),
779 'publishedAt' => $request->request->get('published_at'), 789 'publishedAt' => $request->request->get('published_at'),
780 'authors' => $request->request->get('authors', ''), 790 'authors' => $request->request->get('authors', ''),
791 'origin_url' => $request->request->get('origin_url', ''),
781 ]; 792 ];
782 } 793 }
783 794