aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Controller/EntryController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/WallabagBundle/Controller/EntryController.php')
-rw-r--r--src/WallabagBundle/Controller/EntryController.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/WallabagBundle/Controller/EntryController.php b/src/WallabagBundle/Controller/EntryController.php
index fbbb76aa..dc1876fa 100644
--- a/src/WallabagBundle/Controller/EntryController.php
+++ b/src/WallabagBundle/Controller/EntryController.php
@@ -7,9 +7,51 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use WallabagBundle\Repository; 8use WallabagBundle\Repository;
9use WallabagBundle\Entity\Entries; 9use WallabagBundle\Entity\Entries;
10use Wallabag\Wallabag\Tools;
11use Wallabag\Wallabag\Url;
10 12
11class EntryController extends Controller 13class EntryController extends Controller
12{ 14{
15
16 /**
17 * @param Request $request
18 * @Route("/new", name="new_entry")
19 * @return \Symfony\Component\HttpFoundation\Response
20 */
21 public function addEntryAction(Request $request)
22 {
23 $entry = new Entries();
24 $entry->setUserId(1);
25
26 $form = $this->createFormBuilder($entry)
27 ->add('url', 'url')
28 ->add('save', 'submit')
29 ->getForm();
30
31 $form->handleRequest($request);
32
33 if ($form->isValid()) {
34
35 $content = Tools::getPageContent(new Url($entry->getUrl()));
36 var_dump($content);die;
37
38 $em = $this->getDoctrine()->getEntityManager();
39 $em->persist($entry);
40 $em->flush();
41
42 $this->get('session')->getFlashBag()->add(
43 'notice',
44 'Entry saved'
45 );
46
47 return $this->redirect($this->generateUrl('homepage'));
48 }
49
50 return $this->render('WallabagBundle:Entry:new.html.twig', array(
51 'form' => $form->createView(),
52 ));
53 }
54
13 /** 55 /**
14 * Shows unread entries for current user 56 * Shows unread entries for current user
15 * 57 *