3 namespace Wallabag\ApiBundle\Controller
;
5 use Hateoas\Configuration\Route
;
6 use Hateoas\Representation\Factory\PagerfantaFactory
;
7 use Nelmio\ApiDocBundle\Annotation\ApiDoc
;
8 use Symfony\Component\HttpFoundation\JsonResponse
;
9 use Symfony\Component\HttpFoundation\Request
;
10 use Symfony\Component\HttpFoundation\Response
;
11 use Symfony\Component\HttpKernel\Exception\BadRequestHttpException
;
12 use Symfony\Component\HttpKernel\Exception\HttpException
;
13 use Wallabag\CoreBundle\Entity\Entry
;
14 use Wallabag\CoreBundle\Entity\Tag
;
15 use Wallabag\CoreBundle\Event\EntryDeletedEvent
;
16 use Wallabag\CoreBundle\Event\EntrySavedEvent
;
18 class EntryRestController
extends WallabagRestController
21 * Check if an entry exist by url.
22 * Return ID if entry(ies) exist (and if you give the return_id parameter).
23 * Otherwise it returns false.
25 * @todo Remove that `return_id` in the next major release
29 * {"name"="return_id", "dataType"="string", "required"=false, "format"="1 or 0", "description"="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default"},
30 * {"name"="url", "dataType"="string", "required"=true, "format"="An url", "description"="DEPRECATED, use hashed_url instead"},
31 * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="DEPRECATED, use hashed_urls instead"},
32 * {"name"="hashed_url", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"},
33 * {"name"="hashed_urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Md5 urls (as an array) to check if it exists"}
37 * @return JsonResponse
39 public function getEntriesExistsAction(Request
$request)
41 $this->validateAuthentication();
42 $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
44 $returnId = (null === $request->query
->get('return_id')) ? false : (bool) $request->query
->get('return_id');
46 $urls = $request->query
->get('urls', []);
47 $hashedUrls = $request->query
->get('hashed_urls', []);
49 // handle multiple urls first
50 if (!empty($hashedUrls)) {
52 foreach ($hashedUrls as $hashedUrl) {
53 $res = $repo->findByHashedUrlAndUserId($hashedUrl, $this->getUser()->getId());
55 // $results[$url] = $this->returnExistInformation($res, $returnId);
56 $results[$hashedUrl] = $this->returnExistInformation($res, $returnId);
59 return $this->sendResponse($results);
62 // @deprecated, to be remove in 3.0
65 foreach ($urls as $url) {
66 $res = $repo->findByUrlAndUserId($url, $this->getUser()->getId());
68 $results[$url] = $this->returnExistInformation($res, $returnId);
71 return $this->sendResponse($results);
74 // let's see if it is a simple url?
75 $url = $request->query
->get('url', '');
76 $hashedUrl = $request->query
->get('hashed_url', '');
78 if (empty($url) && empty($hashedUrl)) {
79 throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId());
82 $method = 'findByUrlAndUserId';
83 if (!empty($hashedUrl)) {
84 $method = 'findByHashedUrlAndUserId';
88 $res = $repo->$method($url, $this->getUser()->getId());
90 return $this->sendResponse(['exists' => $this->returnExistInformation($res, $returnId)]);
94 * Retrieve all entries. It could be filtered by many options.
98 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."},
99 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."},
100 * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated' or 'archived', default 'created'", "description"="sort entries by date."},
101 * {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."},
102 * {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."},
103 * {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."},
104 * {"name"="tags", "dataType"="string", "required"=false, "format"="api,rest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."},
105 * {"name"="since", "dataType"="integer", "required"=false, "format"="default '0'", "description"="The timestamp since when you want entries updated."},
106 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"},
110 * @return JsonResponse
112 public function getEntriesAction(Request
$request)
114 $this->validateAuthentication();
116 $isArchived = (null === $request->query
->get('archive')) ? null : (bool) $request->query
->get('archive');
117 $isStarred = (null === $request->query
->get('starred')) ? null : (bool) $request->query
->get('starred');
118 $isPublic = (null === $request->query
->get('public')) ? null : (bool) $request->query
->get('public');
119 $sort = strtolower($request->query
->get('sort', 'created'));
120 $order = strtolower($request->query
->get('order', 'desc'));
121 $page = (int) $request->query
->get('page', 1);
122 $perPage = (int) $request->query
->get('perPage', 30);
123 $tags = \
is_array($request->query
->get('tags')) ? '' : (string) $request->query
->get('tags', '');
124 $since = $request->query
->get('since', 0);
127 /** @var \Pagerfanta\Pagerfanta $pager */
128 $pager = $this->get('wallabag_core.entry_repository')->findEntries(
129 $this->getUser()->getId(),
138 } catch (\Exception
$e) {
139 throw new BadRequestHttpException($e->getMessage());
142 $pager->setMaxPerPage($perPage);
143 $pager->setCurrentPage($page);
145 $pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
146 $paginatedCollection = $pagerfantaFactory->createRepresentation(
151 'archive' => $isArchived,
152 'starred' => $isStarred,
153 'public' => $isPublic,
157 'perPage' => $perPage,
165 return $this->sendResponse($paginatedCollection);
169 * Retrieve a single entry.
173 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
177 * @return JsonResponse
179 public function getEntryAction(Entry
$entry)
181 $this->validateAuthentication();
182 $this->validateUserAccess($entry->getUser()->getId());
184 return $this->sendResponse($entry);
188 * Retrieve a single entry as a predefined format.
192 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
198 public function getEntryExportAction(Entry
$entry, Request
$request)
200 $this->validateAuthentication();
201 $this->validateUserAccess($entry->getUser()->getId());
203 return $this->get('wallabag_core.helper.entries_export')
205 ->updateTitle('entry')
206 ->updateAuthor('entry')
207 ->exportAs($request->attributes
->get('_format'));
211 * Handles an entries list and delete URL.
215 * {"name"="urls", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", "description"="Urls (as an array) to delete."}
219 * @return JsonResponse
221 public function deleteEntriesListAction(Request
$request)
223 $this->validateAuthentication();
225 $urls = json_decode($request->query
->get('urls', []));
228 return $this->sendResponse([]);
233 // handle multiple urls
234 foreach ($urls as $key => $url) {
235 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
237 $this->getUser()->getId()
240 $results[$key]['url'] = $url;
242 if (false !== $entry) {
243 $em = $this->getDoctrine()->getManager();
247 // entry deleted, dispatch event about it!
248 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent
::NAME
, new EntryDeletedEvent($entry));
251 $results[$key]['entry'] = $entry instanceof Entry
? true : false;
254 return $this->sendResponse($results);
258 * Handles an entries list and create URL.
262 * {"name"="urls", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", "description"="Urls (as an array) to create."}
266 * @throws HttpException When limit is reached
268 * @return JsonResponse
270 public function postEntriesListAction(Request
$request)
272 $this->validateAuthentication();
274 $urls = json_decode($request->query
->get('urls', []));
276 $limit = $this->container
->getParameter('wallabag_core.api_limit_mass_actions');
278 if (\
count($urls) > $limit) {
279 throw new HttpException(400, 'API limit reached');
284 return $this->sendResponse($results);
287 // handle multiple urls
288 foreach ($urls as $key => $url) {
289 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
291 $this->getUser()->getId()
294 $results[$key]['url'] = $url;
296 if (false === $entry) {
297 $entry = new Entry($this->getUser());
299 $this->get('wallabag_core.content_proxy')->updateEntry($entry, $url);
302 $em = $this->getDoctrine()->getManager();
303 $em->persist($entry);
306 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
308 // entry saved, dispatch event about it!
309 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
312 return $this->sendResponse($results);
318 * If you want to provide the HTML content (which means wallabag won't fetch it from the url), you must provide `content`, `title` & `url` fields **non-empty**.
319 * Otherwise, content will be fetched as normal from the url and values will be overwritten.
323 * {"name"="url", "dataType"="string", "required"=true, "format"="http://www.test.com/article.html", "description"="Url for the entry."},
324 * {"name"="title", "dataType"="string", "required"=false, "description"="Optional, we'll get the title from the page."},
325 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
326 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="entry already archived"},
327 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="entry already starred"},
328 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"},
329 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
330 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
331 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
332 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
333 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
334 * {"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)."},
338 * @return JsonResponse
340 public function postEntriesAction(Request
$request)
342 $this->validateAuthentication();
344 $url = $request->request
->get('url');
346 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
348 $this->getUser()->getId()
351 if (false === $entry) {
352 $entry = new Entry($this->getUser());
353 $entry->setUrl($url);
356 $data = $this->retrieveValueFromRequest($request);
359 $this->get('wallabag_core.content_proxy')->updateEntry(
363 'title' => !empty($data['title']) ? $data['title'] : $entry->getTitle(),
364 'html' => !empty($data['content']) ? $data['content'] : $entry->getContent(),
365 'url' => $entry->getUrl(),
366 'language' => !empty($data['language']) ? $data['language'] : $entry->getLanguage(),
367 'date' => !empty($data['publishedAt']) ? $data['publishedAt'] : $entry->getPublishedAt(),
368 // faking the open graph preview picture
370 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(),
372 'authors' => \
is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(),
375 } catch (\Exception
$e) {
376 $this->get('logger')->error('Error while saving an entry', [
382 if (null !== $data['isArchived']) {
383 $entry->updateArchived((bool) $data['isArchived']);
386 if (null !== $data['isStarred']) {
387 $entry->updateStar((bool) $data['isStarred']);
390 if (!empty($data['tags'])) {
391 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
394 if (!empty($data['origin_url'])) {
395 $entry->setOriginUrl($data['origin_url']);
398 if (null !== $data['isPublic']) {
399 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
400 $entry->generateUid();
401 } elseif (false === (bool) $data['isPublic']) {
406 if (empty($entry->getDomainName())) {
407 $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
410 if (empty($entry->getTitle())) {
411 $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
414 $em = $this->getDoctrine()->getManager();
415 $em->persist($entry);
418 // entry saved, dispatch event about it!
419 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
421 return $this->sendResponse($entry);
425 * Change several properties of an entry.
429 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
432 * {"name"="title", "dataType"="string", "required"=false},
433 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
434 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="archived the entry."},
435 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="starred the entry."},
436 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"},
437 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
438 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
439 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
440 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
441 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
442 * {"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)."},
446 * @return JsonResponse
448 public function patchEntriesAction(Entry
$entry, Request
$request)
450 $this->validateAuthentication();
451 $this->validateUserAccess($entry->getUser()->getId());
453 $contentProxy = $this->get('wallabag_core.content_proxy');
455 $data = $this->retrieveValueFromRequest($request);
457 // this is a special case where user want to manually update the entry content
458 // the ContentProxy will only cleanup the html
459 // and also we force to not re-fetch the content in case of error
460 if (!empty($data['content'])) {
462 $contentProxy->updateEntry(
466 'html' => $data['content'],
470 } catch (\Exception
$e) {
471 $this->get('logger')->error('Error while saving an entry', [
478 if (!empty($data['title'])) {
479 $entry->setTitle($data['title']);
482 if (!empty($data['language'])) {
483 $contentProxy->updateLanguage($entry, $data['language']);
486 if (!empty($data['authors']) && \
is_string($data['authors'])) {
487 $entry->setPublishedBy(explode(',', $data['authors']));
490 if (!empty($data['picture'])) {
491 $contentProxy->updatePreviewPicture($entry, $data['picture']);
494 if (!empty($data['publishedAt'])) {
495 $contentProxy->updatePublishedAt($entry, $data['publishedAt']);
498 if (null !== $data['isArchived']) {
499 $entry->updateArchived((bool) $data['isArchived']);
502 if (null !== $data['isStarred']) {
503 $entry->updateStar((bool) $data['isStarred']);
506 if (!empty($data['tags'])) {
507 $entry->removeAllTags();
508 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
511 if (null !== $data['isPublic']) {
512 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
513 $entry->generateUid();
514 } elseif (false === (bool) $data['isPublic']) {
519 if (!empty($data['origin_url'])) {
520 $entry->setOriginUrl($data['origin_url']);
523 if (empty($entry->getDomainName())) {
524 $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
527 if (empty($entry->getTitle())) {
528 $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
531 $em = $this->getDoctrine()->getManager();
532 $em->persist($entry);
535 // entry saved, dispatch event about it!
536 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
538 return $this->sendResponse($entry);
543 * An empty response with HTTP Status 304 will be send if we weren't able to update the content (because it hasn't changed or we got an error).
547 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
551 * @return JsonResponse
553 public function patchEntriesReloadAction(Entry
$entry)
555 $this->validateAuthentication();
556 $this->validateUserAccess($entry->getUser()->getId());
559 $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
560 } catch (\Exception
$e) {
561 $this->get('logger')->error('Error while saving an entry', [
566 return new JsonResponse([], 304);
569 // if refreshing entry failed, don't save it
570 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
571 return new JsonResponse([], 304);
574 $em = $this->getDoctrine()->getManager();
575 $em->persist($entry);
578 // entry saved, dispatch event about it!
579 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
581 return $this->sendResponse($entry);
585 * Delete **permanently** an entry.
589 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
592 * {"name"="expect", "dataType"="string", "required"=false, "format"="id or entry", "description"="Only returns the id instead of the deleted entry's full entity if 'id' is specified. Default to entry"},
596 * @return JsonResponse
598 public function deleteEntriesAction(Entry
$entry, Request
$request)
600 $expect = $request->query
->get('expect', 'entry');
601 if (!\
in_array($expect, ['id', 'entry'], true)) {
602 throw new BadRequestHttpException(sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
604 $this->validateAuthentication();
605 $this->validateUserAccess($entry->getUser()->getId());
607 $response = $this->sendResponse([
608 'id' => $entry->getId(),
610 // We clone $entry to keep id in returned object
611 if ('entry' === $expect) {
613 $response = $this->sendResponse($e);
616 $em = $this->getDoctrine()->getManager();
620 // entry deleted, dispatch event about it!
621 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent
::NAME
, new EntryDeletedEvent($entry));
627 * Retrieve all tags for an entry.
631 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
635 * @return JsonResponse
637 public function getEntriesTagsAction(Entry
$entry)
639 $this->validateAuthentication();
640 $this->validateUserAccess($entry->getUser()->getId());
642 return $this->sendResponse($entry->getTags());
646 * Add one or more tags to an entry.
650 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
653 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
657 * @return JsonResponse
659 public function postEntriesTagsAction(Request
$request, Entry
$entry)
661 $this->validateAuthentication();
662 $this->validateUserAccess($entry->getUser()->getId());
664 $tags = $request->request
->get('tags', '');
666 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
669 $em = $this->getDoctrine()->getManager();
670 $em->persist($entry);
673 return $this->sendResponse($entry);
677 * Permanently remove one tag for an entry.
681 * {"name"="tag", "dataType"="integer", "requirement"="\w+", "description"="The tag ID"},
682 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
686 * @return JsonResponse
688 public function deleteEntriesTagsAction(Entry
$entry, Tag
$tag)
690 $this->validateAuthentication();
691 $this->validateUserAccess($entry->getUser()->getId());
693 $entry->removeTag($tag);
694 $em = $this->getDoctrine()->getManager();
695 $em->persist($entry);
698 return $this->sendResponse($entry);
702 * Handles an entries list delete tags from them.
706 * {"name"="list", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]", "description"="Urls (as an array) to handle."}
710 * @return JsonResponse
712 public function deleteEntriesTagsListAction(Request
$request)
714 $this->validateAuthentication();
716 $list = json_decode($request->query
->get('list', []));
719 return $this->sendResponse([]);
722 // handle multiple urls
725 foreach ($list as $key => $element) {
726 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
728 $this->getUser()->getId()
731 $results[$key]['url'] = $element->url
;
732 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
734 $tags = $element->tags
;
736 if (false !== $entry && !(empty($tags))) {
737 $tags = explode(',', $tags);
738 foreach ($tags as $label) {
739 $label = trim($label);
741 $tag = $this->getDoctrine()
742 ->getRepository('WallabagCoreBundle:Tag')
743 ->findOneByLabel($label);
745 if (false !== $tag) {
746 $entry->removeTag($tag);
750 $em = $this->getDoctrine()->getManager();
751 $em->persist($entry);
756 return $this->sendResponse($results);
760 * Handles an entries list and add tags to them.
764 * {"name"="list", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]", "description"="Urls (as an array) to handle."}
768 * @return JsonResponse
770 public function postEntriesTagsListAction(Request
$request)
772 $this->validateAuthentication();
774 $list = json_decode($request->query
->get('list', []));
777 return $this->sendResponse([]);
782 // handle multiple urls
783 foreach ($list as $key => $element) {
784 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
786 $this->getUser()->getId()
789 $results[$key]['url'] = $element->url
;
790 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
792 $tags = $element->tags
;
794 if (false !== $entry && !(empty($tags))) {
795 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
797 $em = $this->getDoctrine()->getManager();
798 $em->persist($entry);
803 return $this->sendResponse($results);
807 * Retrieve value from the request.
808 * Used for POST & PATCH on a an entry.
810 * @param Request $request
814 private function retrieveValueFromRequest(Request
$request)
817 'title' => $request->request
->get('title'),
818 'tags' => $request->request
->get('tags', []),
819 'isArchived' => $request->request
->get('archive'),
820 'isStarred' => $request->request
->get('starred'),
821 'isPublic' => $request->request
->get('public'),
822 'content' => $request->request
->get('content'),
823 'language' => $request->request
->get('language'),
824 'picture' => $request->request
->get('preview_picture'),
825 'publishedAt' => $request->request
->get('published_at'),
826 'authors' => $request->request
->get('authors', ''),
827 'origin_url' => $request->request
->get('origin_url', ''),
832 * Return information about the entry if it exist and depending on the id or not.
834 * @param Entry|null $entry
835 * @param bool $returnId
839 private function returnExistInformation($entry, $returnId)
842 return $entry instanceof Entry
? $entry->getId() : null;
845 return $entry instanceof Entry
;