+ /**
+ * Get public URL for entry (and generate it if necessary).
+ *
+ * @param Entry $entry
+ *
+ * @Route("/share/{id}", requirements={"id" = "\d+"}, name="share")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function shareAction(Entry $entry)
+ {
+ $this->checkUserAction($entry);
+
+ if ('' === $entry->getUuid() || null === $entry->getUuid()) {
+ $this->generateEntryUuid($entry);
+ }
+
+ return $this->redirect($this->generateUrl('share_entry', [
+ 'uuid' => $entry->getUuid(),
+ ]));
+ }
+
+ /**
+ * Disable public sharing for an entry.
+ *
+ * @param Entry $entry
+ *
+ * @Route("/share/delete/{id}", requirements={"id" = "\d+"}, name="delete_share")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function deleteShareAction(Entry $entry)
+ {
+ $this->checkUserAction($entry);
+
+ $entry->cleanUuid();
+ $em = $this->getDoctrine()->getManager();
+ $em->persist($entry);
+ $em->flush();
+
+ return $this->redirect($this->generateUrl('view', [
+ 'id' => $entry->getId(),
+ ]));
+ }
+