+ $existingEntry = $this->checkIfEntryAlreadyExists($entry);
+
+ if (false !== $existingEntry) {
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ $this->get('translator')->trans('flashes.entry.notice.entry_already_saved', array('%date%' => $existingEntry->getCreatedAt()->format('d-m-Y')))
+ );
+
+ return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId())));
+ }
+
+ $this->updateEntry($entry);
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'flashes.entry.notice.entry_saved'
+ );
+
+ return $this->redirect($this->generateUrl('homepage'));
+ }
+
+ return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array(
+ 'form' => $form->createView(),
+ ));
+ }
+
+ /**
+ * @param Request $request
+ *
+ * @Route("/bookmarklet", name="bookmarklet")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function addEntryViaBookmarkletAction(Request $request)
+ {
+ $entry = new Entry($this->getUser());
+ $entry->setUrl($request->get('url'));
+
+ if (false === $this->checkIfEntryAlreadyExists($entry)) {
+ $this->updateEntry($entry);
+ }
+
+ return $this->redirect($this->generateUrl('homepage'));
+ }
+
+ /**
+ * @Route("/new", name="new")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function addEntryAction()
+ {
+ return $this->render('WallabagCoreBundle:Entry:new.html.twig');
+ }