aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php11
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php33
2 files changed, 44 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index 6f161a08..5a9afc69 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."},
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."},
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
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index cfb8db75..445cc45e 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -245,6 +245,15 @@ class Entry
245 */ 245 */
246 private $tags; 246 private $tags;
247 247
248 /**
249 * @var string
250 *
251 * @ORM\Column(name="origin_url", type="text", nullable=true)
252 *
253 * @Groups({"entries_for_user", "export_all"})
254 */
255 private $originUrl;
256
248 /* 257 /*
249 * @param User $user 258 * @param User $user
250 */ 259 */
@@ -831,4 +840,28 @@ class Entry
831 840
832 return $this; 841 return $this;
833 } 842 }
843
844 /**
845 * Set origin url.
846 *
847 * @param string $originUrl
848 *
849 * @return Entry
850 */
851 public function setOriginUrl($originUrl)
852 {
853 $this->originUrl = $originUrl;
854
855 return $this;
856 }
857
858 /**
859 * Get origin url.
860 *
861 * @return string
862 */
863 public function getOriginUrl()
864 {
865 return $this->originUrl;
866 }
834} 867}