aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Controller/EntryController.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 14:58:17 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 14:58:17 +0100
commitb84a80559a1167b5500fbc5eb4965d3b08b371ef (patch)
treef7d0e9917f650b6317b986c9e8baf38880a4fb2e /src/WallabagBundle/Controller/EntryController.php
parent163eae0bb15d0daa5390f434a42a8176eca186e7 (diff)
downloadwallabag-b84a80559a1167b5500fbc5eb4965d3b08b371ef.tar.gz
wallabag-b84a80559a1167b5500fbc5eb4965d3b08b371ef.tar.zst
wallabag-b84a80559a1167b5500fbc5eb4965d3b08b371ef.zip
some parameters, new entry form, etc.
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 *