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"="Url to check if it exists"},
31 * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Urls (as an array) to check if it exists"}
32 * {"name"="hashedurl", "dataType"="string", "required"=true, "format"="An url", "description"="Md5 url to check if it exists"},
33 * {"name"="hashedurls", "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();
43 $returnId = (null === $request->query
->get('return_id')) ? false : (bool) $request->query
->get('return_id');
44 $urls = $request->query
->get('urls', []);
46 $hashedUrls = $request->query
->get('hashedurls', []);
48 // handle multiple urls first
49 if (!empty($hashedUrls)) {
51 foreach ($hashedUrls as $hashedUrl) {
52 $res = $this->getDoctrine()
53 ->getRepository('WallabagCoreBundle:Entry')
55 'hashedUrl' => $hashedUrl,
56 'user' => $this->getUser()->getId(),
59 // $results[$url] = $this->returnExistInformation($res, $returnId);
60 $results[$hashedUrl] = $this->returnExistInformation($res, $returnId);
63 return $this->sendResponse($results);
66 // let's see if it is a simple url?
67 $hashedUrl = $request->query
->get('hashedurl', '');
70 // throw $this->createAccessDeniedException('URL is empty?, logged user id: ' . $this->getUser()->getId());
73 if (empty($hashedUrl)) {
74 throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId());
77 $res = $this->getDoctrine()
78 ->getRepository('WallabagCoreBundle:Entry')
79 // ->findByUrlAndUserId($url, $this->getUser()->getId());
81 'hashedUrl' => $hashedUrl,
82 'user' => $this->getUser()->getId(),
85 return $this->sendResponse(['exists' => $this->returnExistInformation($res, $returnId)]);
89 * Retrieve all entries. It could be filtered by many options.
93 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."},
94 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."},
95 * {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated' or 'archived', default 'created'", "description"="sort entries by date."},
96 * {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."},
97 * {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."},
98 * {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."},
99 * {"name"="tags", "dataType"="string", "required"=false, "format"="api,rest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."},
100 * {"name"="since", "dataType"="integer", "required"=false, "format"="default '0'", "description"="The timestamp since when you want entries updated."},
101 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"},
105 * @return JsonResponse
107 public function getEntriesAction(Request
$request)
109 $this->validateAuthentication();
111 $isArchived = (null === $request->query
->get('archive')) ? null : (bool) $request->query
->get('archive');
112 $isStarred = (null === $request->query
->get('starred')) ? null : (bool) $request->query
->get('starred');
113 $isPublic = (null === $request->query
->get('public')) ? null : (bool) $request->query
->get('public');
114 $sort = strtolower($request->query
->get('sort', 'created'));
115 $order = strtolower($request->query
->get('order', 'desc'));
116 $page = (int) $request->query
->get('page', 1);
117 $perPage = (int) $request->query
->get('perPage', 30);
118 $tags = \
is_array($request->query
->get('tags')) ? '' : (string) $request->query
->get('tags', '');
119 $since = $request->query
->get('since', 0);
122 /** @var \Pagerfanta\Pagerfanta $pager */
123 $pager = $this->get('wallabag_core.entry_repository')->findEntries(
124 $this->getUser()->getId(),
133 } catch (\Exception
$e) {
134 throw new BadRequestHttpException($e->getMessage());
137 $pager->setMaxPerPage($perPage);
138 $pager->setCurrentPage($page);
140 $pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
141 $paginatedCollection = $pagerfantaFactory->createRepresentation(
146 'archive' => $isArchived,
147 'starred' => $isStarred,
148 'public' => $isPublic,
152 'perPage' => $perPage,
160 return $this->sendResponse($paginatedCollection);
164 * Retrieve a single entry.
168 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
172 * @return JsonResponse
174 public function getEntryAction(Entry
$entry)
176 $this->validateAuthentication();
177 $this->validateUserAccess($entry->getUser()->getId());
179 return $this->sendResponse($entry);
183 * Retrieve a single entry as a predefined format.
187 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
193 public function getEntryExportAction(Entry
$entry, Request
$request)
195 $this->validateAuthentication();
196 $this->validateUserAccess($entry->getUser()->getId());
198 return $this->get('wallabag_core.helper.entries_export')
200 ->updateTitle('entry')
201 ->updateAuthor('entry')
202 ->exportAs($request->attributes
->get('_format'));
206 * Handles an entries list and delete URL.
210 * {"name"="urls", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", "description"="Urls (as an array) to delete."}
214 * @return JsonResponse
216 public function deleteEntriesListAction(Request
$request)
218 $this->validateAuthentication();
220 $urls = json_decode($request->query
->get('urls', []));
223 return $this->sendResponse([]);
228 // handle multiple urls
229 foreach ($urls as $key => $url) {
230 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
232 $this->getUser()->getId()
235 $results[$key]['url'] = $url;
237 if (false !== $entry) {
238 $em = $this->getDoctrine()->getManager();
242 // entry deleted, dispatch event about it!
243 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent
::NAME
, new EntryDeletedEvent($entry));
246 $results[$key]['entry'] = $entry instanceof Entry
? true : false;
249 return $this->sendResponse($results);
253 * Handles an entries list and create URL.
257 * {"name"="urls", "dataType"="string", "required"=true, "format"="A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", "description"="Urls (as an array) to create."}
261 * @throws HttpException When limit is reached
263 * @return JsonResponse
265 public function postEntriesListAction(Request
$request)
267 $this->validateAuthentication();
269 $urls = json_decode($request->query
->get('urls', []));
271 $limit = $this->container
->getParameter('wallabag_core.api_limit_mass_actions');
273 if (\
count($urls) > $limit) {
274 throw new HttpException(400, 'API limit reached');
279 return $this->sendResponse($results);
282 // handle multiple urls
283 foreach ($urls as $key => $url) {
284 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
286 $this->getUser()->getId()
289 $results[$key]['url'] = $url;
291 if (false === $entry) {
292 $entry = new Entry($this->getUser());
294 $this->get('wallabag_core.content_proxy')->updateEntry($entry, $url);
297 $em = $this->getDoctrine()->getManager();
298 $em->persist($entry);
301 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
303 // entry saved, dispatch event about it!
304 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
307 return $this->sendResponse($results);
313 * 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**.
314 * Otherwise, content will be fetched as normal from the url and values will be overwritten.
318 * {"name"="url", "dataType"="string", "required"=true, "format"="http://www.test.com/article.html", "description"="Url for the entry."},
319 * {"name"="title", "dataType"="string", "required"=false, "description"="Optional, we'll get the title from the page."},
320 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
321 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="entry already archived"},
322 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="entry already starred"},
323 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"},
324 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
325 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
326 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
327 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
328 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
329 * {"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)."},
333 * @return JsonResponse
335 public function postEntriesAction(Request
$request)
337 $this->validateAuthentication();
339 $url = $request->request
->get('url');
341 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
343 $this->getUser()->getId()
346 if (false === $entry) {
347 $entry = new Entry($this->getUser());
348 $entry->setUrl($url);
351 $data = $this->retrieveValueFromRequest($request);
354 $this->get('wallabag_core.content_proxy')->updateEntry(
358 'title' => !empty($data['title']) ? $data['title'] : $entry->getTitle(),
359 'html' => !empty($data['content']) ? $data['content'] : $entry->getContent(),
360 'url' => $entry->getUrl(),
361 'language' => !empty($data['language']) ? $data['language'] : $entry->getLanguage(),
362 'date' => !empty($data['publishedAt']) ? $data['publishedAt'] : $entry->getPublishedAt(),
363 // faking the open graph preview picture
365 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(),
367 'authors' => \
is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(),
370 } catch (\Exception
$e) {
371 $this->get('logger')->error('Error while saving an entry', [
377 if (null !== $data['isArchived']) {
378 $entry->updateArchived((bool) $data['isArchived']);
381 if (null !== $data['isStarred']) {
382 $entry->updateStar((bool) $data['isStarred']);
385 if (!empty($data['tags'])) {
386 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
389 if (!empty($data['origin_url'])) {
390 $entry->setOriginUrl($data['origin_url']);
393 if (null !== $data['isPublic']) {
394 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
395 $entry->generateUid();
396 } elseif (false === (bool) $data['isPublic']) {
401 if (empty($entry->getDomainName())) {
402 $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
405 if (empty($entry->getTitle())) {
406 $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
409 $em = $this->getDoctrine()->getManager();
410 $em->persist($entry);
413 // entry saved, dispatch event about it!
414 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
416 return $this->sendResponse($entry);
420 * Change several properties of an entry.
424 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
427 * {"name"="title", "dataType"="string", "required"=false},
428 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
429 * {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="archived the entry."},
430 * {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="starred the entry."},
431 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"},
432 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
433 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
434 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
435 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
436 * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
437 * {"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)."},
441 * @return JsonResponse
443 public function patchEntriesAction(Entry
$entry, Request
$request)
445 $this->validateAuthentication();
446 $this->validateUserAccess($entry->getUser()->getId());
448 $contentProxy = $this->get('wallabag_core.content_proxy');
450 $data = $this->retrieveValueFromRequest($request);
452 // this is a special case where user want to manually update the entry content
453 // the ContentProxy will only cleanup the html
454 // and also we force to not re-fetch the content in case of error
455 if (!empty($data['content'])) {
457 $contentProxy->updateEntry(
461 'html' => $data['content'],
465 } catch (\Exception
$e) {
466 $this->get('logger')->error('Error while saving an entry', [
473 if (!empty($data['title'])) {
474 $entry->setTitle($data['title']);
477 if (!empty($data['language'])) {
478 $contentProxy->updateLanguage($entry, $data['language']);
481 if (!empty($data['authors']) && \
is_string($data['authors'])) {
482 $entry->setPublishedBy(explode(',', $data['authors']));
485 if (!empty($data['picture'])) {
486 $contentProxy->updatePreviewPicture($entry, $data['picture']);
489 if (!empty($data['publishedAt'])) {
490 $contentProxy->updatePublishedAt($entry, $data['publishedAt']);
493 if (null !== $data['isArchived']) {
494 $entry->updateArchived((bool) $data['isArchived']);
497 if (null !== $data['isStarred']) {
498 $entry->updateStar((bool) $data['isStarred']);
501 if (!empty($data['tags'])) {
502 $entry->removeAllTags();
503 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
506 if (null !== $data['isPublic']) {
507 if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
508 $entry->generateUid();
509 } elseif (false === (bool) $data['isPublic']) {
514 if (!empty($data['origin_url'])) {
515 $entry->setOriginUrl($data['origin_url']);
518 if (empty($entry->getDomainName())) {
519 $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
522 if (empty($entry->getTitle())) {
523 $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
526 $em = $this->getDoctrine()->getManager();
527 $em->persist($entry);
530 // entry saved, dispatch event about it!
531 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
533 return $this->sendResponse($entry);
538 * 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).
542 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
546 * @return JsonResponse
548 public function patchEntriesReloadAction(Entry
$entry)
550 $this->validateAuthentication();
551 $this->validateUserAccess($entry->getUser()->getId());
554 $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
555 } catch (\Exception
$e) {
556 $this->get('logger')->error('Error while saving an entry', [
561 return new JsonResponse([], 304);
564 // if refreshing entry failed, don't save it
565 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
566 return new JsonResponse([], 304);
569 $em = $this->getDoctrine()->getManager();
570 $em->persist($entry);
573 // entry saved, dispatch event about it!
574 $this->get('event_dispatcher')->dispatch(EntrySavedEvent
::NAME
, new EntrySavedEvent($entry));
576 return $this->sendResponse($entry);
580 * Delete **permanently** an entry.
584 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
587 * {"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"},
591 * @return JsonResponse
593 public function deleteEntriesAction(Entry
$entry, Request
$request)
595 $expect = $request->query
->get('expect', 'entry');
596 if (!\
in_array($expect, ['id', 'entry'], true)) {
597 throw new BadRequestHttpException(sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
599 $this->validateAuthentication();
600 $this->validateUserAccess($entry->getUser()->getId());
602 $response = $this->sendResponse([
603 'id' => $entry->getId(),
605 // We clone $entry to keep id in returned object
606 if ('entry' === $expect) {
608 $response = $this->sendResponse($e);
611 $em = $this->getDoctrine()->getManager();
615 // entry deleted, dispatch event about it!
616 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent
::NAME
, new EntryDeletedEvent($entry));
622 * Retrieve all tags for an entry.
626 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
630 * @return JsonResponse
632 public function getEntriesTagsAction(Entry
$entry)
634 $this->validateAuthentication();
635 $this->validateUserAccess($entry->getUser()->getId());
637 return $this->sendResponse($entry->getTags());
641 * Add one or more tags to an entry.
645 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
648 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
652 * @return JsonResponse
654 public function postEntriesTagsAction(Request
$request, Entry
$entry)
656 $this->validateAuthentication();
657 $this->validateUserAccess($entry->getUser()->getId());
659 $tags = $request->request
->get('tags', '');
661 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
664 $em = $this->getDoctrine()->getManager();
665 $em->persist($entry);
668 return $this->sendResponse($entry);
672 * Permanently remove one tag for an entry.
676 * {"name"="tag", "dataType"="integer", "requirement"="\w+", "description"="The tag ID"},
677 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
681 * @return JsonResponse
683 public function deleteEntriesTagsAction(Entry
$entry, Tag
$tag)
685 $this->validateAuthentication();
686 $this->validateUserAccess($entry->getUser()->getId());
688 $entry->removeTag($tag);
689 $em = $this->getDoctrine()->getManager();
690 $em->persist($entry);
693 return $this->sendResponse($entry);
697 * Handles an entries list delete tags from them.
701 * {"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."}
705 * @return JsonResponse
707 public function deleteEntriesTagsListAction(Request
$request)
709 $this->validateAuthentication();
711 $list = json_decode($request->query
->get('list', []));
714 return $this->sendResponse([]);
717 // handle multiple urls
720 foreach ($list as $key => $element) {
721 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
723 $this->getUser()->getId()
726 $results[$key]['url'] = $element->url
;
727 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
729 $tags = $element->tags
;
731 if (false !== $entry && !(empty($tags))) {
732 $tags = explode(',', $tags);
733 foreach ($tags as $label) {
734 $label = trim($label);
736 $tag = $this->getDoctrine()
737 ->getRepository('WallabagCoreBundle:Tag')
738 ->findOneByLabel($label);
740 if (false !== $tag) {
741 $entry->removeTag($tag);
745 $em = $this->getDoctrine()->getManager();
746 $em->persist($entry);
751 return $this->sendResponse($results);
755 * Handles an entries list and add tags to them.
759 * {"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."}
763 * @return JsonResponse
765 public function postEntriesTagsListAction(Request
$request)
767 $this->validateAuthentication();
769 $list = json_decode($request->query
->get('list', []));
772 return $this->sendResponse([]);
777 // handle multiple urls
778 foreach ($list as $key => $element) {
779 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
781 $this->getUser()->getId()
784 $results[$key]['url'] = $element->url
;
785 $results[$key]['entry'] = $entry instanceof Entry
? $entry->getId() : false;
787 $tags = $element->tags
;
789 if (false !== $entry && !(empty($tags))) {
790 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
792 $em = $this->getDoctrine()->getManager();
793 $em->persist($entry);
798 return $this->sendResponse($results);
802 * Retrieve value from the request.
803 * Used for POST & PATCH on a an entry.
805 * @param Request $request
809 private function retrieveValueFromRequest(Request
$request)
812 'title' => $request->request
->get('title'),
813 'tags' => $request->request
->get('tags', []),
814 'isArchived' => $request->request
->get('archive'),
815 'isStarred' => $request->request
->get('starred'),
816 'isPublic' => $request->request
->get('public'),
817 'content' => $request->request
->get('content'),
818 'language' => $request->request
->get('language'),
819 'picture' => $request->request
->get('preview_picture'),
820 'publishedAt' => $request->request
->get('published_at'),
821 'authors' => $request->request
->get('authors', ''),
822 'origin_url' => $request->request
->get('origin_url', ''),
827 * Return information about the entry if it exist and depending on the id or not.
829 * @param Entry|null $entry
830 * @param bool $returnId
834 private function returnExistInformation($entry, $returnId)
837 return $entry instanceof Entry
? $entry->getId() : null;
840 return $entry instanceof Entry
;