From f3d0cb91063840f2b05c63954d3fef3e5b8943fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 10 Apr 2016 17:33:15 +0200 Subject: Share entry with a public URL --- .../CoreBundle/Controller/EntryController.php | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 93db0d6c..a78dd00c 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -291,6 +291,8 @@ class EntryController extends Controller { $this->checkUserAction($entry); + $this->generateEntryUuid($entry); + return $this->render( 'WallabagCoreBundle:Entry:entry.html.twig', ['entry' => $entry] @@ -449,5 +451,34 @@ class EntryController extends Controller private function checkIfEntryAlreadyExists(Entry $entry) { return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); + + } + + /* + * Share entry content. + * + * @param Entry $entry + * + * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share") + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function shareEntry(Entry $entry) + { + return $this->render( + '@WallabagCore/themes/share.html.twig', + array('entry' => $entry) + ); + } + + /** + * @param Entry $entry + */ + private function generateEntryUuid(Entry $entry) + { + $entry->generateUuid(); + $em = $this->getDoctrine()->getManager(); + $em->persist($entry); + $em->flush(); } } -- cgit v1.2.3