diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-23 14:58:17 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-23 14:58:17 +0100 |
commit | b84a80559a1167b5500fbc5eb4965d3b08b371ef (patch) | |
tree | f7d0e9917f650b6317b986c9e8baf38880a4fb2e /src/WallabagBundle/Controller/EntryController.php | |
parent | 163eae0bb15d0daa5390f434a42a8176eca186e7 (diff) | |
download | wallabag-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.php | 42 |
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; | |||
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use WallabagBundle\Repository; | 8 | use WallabagBundle\Repository; |
9 | use WallabagBundle\Entity\Entries; | 9 | use WallabagBundle\Entity\Entries; |
10 | use Wallabag\Wallabag\Tools; | ||
11 | use Wallabag\Wallabag\Url; | ||
10 | 12 | ||
11 | class EntryController extends Controller | 13 | class 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 | * |