+ if ($entry->getUser()->getId() != $this->getUser()->getId()) {
+ throw $this->createAccessDeniedException();
+ }
+
+ $title = $request->request->get("title");
+ $isArchived = $request->request->get("archive");
+ $isStarred = $request->request->get("star");
+
+ if (!is_null($title)) {
+ $entry->setTitle($title);
+ }
+
+ if (!is_null($isArchived)) {
+ $entry->setArchived($isArchived);
+ }
+
+ if (!is_null($isStarred)) {
+ $entry->setStarred($isStarred);
+ }
+
+ $tags = $request->request->get('tags', '');
+ if (!empty($tags)) {
+ $this->assignTagsToEntry($entry, $tags);
+ }
+
+ $em = $this->getDoctrine()->getManager();
+ $em->flush();
+
+ $json = $this->get('serializer')->serialize($entry, 'json');
+
+ return new JsonResponse($json, 200);