$isArchived = $request->request->get('archive');
$isStarred = $request->request->get('starred');
- $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
- new Entry($this->getUser()),
- $url
- );
+ $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId());
+
+ if (false === $entry) {
+ $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
+ new Entry($this->getUser()),
+ $url
+ );
+ }
$tags = $request->request->get('tags', '');
if (!empty($tags)) {
$this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
}
- if (true === (bool) $isStarred) {
+ if ($isStarred === 'true') {
$entry->setStarred(true);
}
- if (true === (bool) $isArchived) {
+ if ($isArchived === 'true') {
$entry->setArchived(true);
}
return $this->renderJsonResponse($json);
}
+ /**
+ * Retrieve version number.
+ *
+ * @ApiDoc()
+ *
+ * @return Response
+ */
+ public function getVersionAction()
+ {
+ $version = $this->container->getParameter('wallabag_core.version');
+
+ $json = $this->get('serializer')->serialize($version, 'json');
+
+ return $this->renderJsonResponse($json);
+ }
/**
* Validate that the first id is equal to the second one.