diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:36:04 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:36:04 +0100 |
commit | 1990517b2263a080946853ed697a6d687262ae80 (patch) | |
tree | 8f676a051a25c65bf2130235e6b30e3f53030154 /src/Acme/DemoBundle/Controller | |
parent | c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf (diff) | |
download | wallabag-1990517b2263a080946853ed697a6d687262ae80.tar.gz wallabag-1990517b2263a080946853ed697a6d687262ae80.tar.zst wallabag-1990517b2263a080946853ed697a6d687262ae80.zip |
remove Acme and AppBundle
Diffstat (limited to 'src/Acme/DemoBundle/Controller')
-rw-r--r-- | src/Acme/DemoBundle/Controller/DemoController.php | 56 | ||||
-rw-r--r-- | src/Acme/DemoBundle/Controller/SecuredController.php | 70 | ||||
-rw-r--r-- | src/Acme/DemoBundle/Controller/WelcomeController.php | 19 |
3 files changed, 0 insertions, 145 deletions
diff --git a/src/Acme/DemoBundle/Controller/DemoController.php b/src/Acme/DemoBundle/Controller/DemoController.php deleted file mode 100644 index a99de891..00000000 --- a/src/Acme/DemoBundle/Controller/DemoController.php +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
6 | use Symfony\Component\HttpFoundation\RedirectResponse; | ||
7 | use Symfony\Component\HttpFoundation\Request; | ||
8 | use Acme\DemoBundle\Form\ContactType; | ||
9 | |||
10 | // these import the "@Route" and "@Template" annotations | ||
11 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
12 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
13 | |||
14 | class DemoController extends Controller | ||
15 | { | ||
16 | /** | ||
17 | * @Route("/", name="_demo") | ||
18 | * @Template() | ||
19 | */ | ||
20 | public function indexAction() | ||
21 | { | ||
22 | return array(); | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * @Route("/hello/{name}", name="_demo_hello") | ||
27 | * @Template() | ||
28 | */ | ||
29 | public function helloAction($name) | ||
30 | { | ||
31 | return array('name' => $name); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * @Route("/contact", name="_demo_contact") | ||
36 | * @Template() | ||
37 | */ | ||
38 | public function contactAction(Request $request) | ||
39 | { | ||
40 | $form = $this->createForm(new ContactType()); | ||
41 | $form->handleRequest($request); | ||
42 | |||
43 | if ($form->isValid()) { | ||
44 | $mailer = $this->get('mailer'); | ||
45 | |||
46 | // .. setup a message and send it | ||
47 | // http://symfony.com/doc/current/cookbook/email.html | ||
48 | |||
49 | $request->getSession()->getFlashBag()->set('notice', 'Message sent!'); | ||
50 | |||
51 | return new RedirectResponse($this->generateUrl('_demo')); | ||
52 | } | ||
53 | |||
54 | return array('form' => $form->createView()); | ||
55 | } | ||
56 | } | ||
diff --git a/src/Acme/DemoBundle/Controller/SecuredController.php b/src/Acme/DemoBundle/Controller/SecuredController.php deleted file mode 100644 index d1499e39..00000000 --- a/src/Acme/DemoBundle/Controller/SecuredController.php +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Component\HttpFoundation\Request; | ||
6 | use Symfony\Component\Security\Core\SecurityContext; | ||
7 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
10 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; | ||
11 | |||
12 | /** | ||
13 | * @Route("/demo/secured") | ||
14 | */ | ||
15 | class SecuredController extends Controller | ||
16 | { | ||
17 | /** | ||
18 | * @Route("/login", name="_demo_login") | ||
19 | * @Template() | ||
20 | */ | ||
21 | public function loginAction(Request $request) | ||
22 | { | ||
23 | if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { | ||
24 | $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); | ||
25 | } else { | ||
26 | $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); | ||
27 | } | ||
28 | |||
29 | return array( | ||
30 | 'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME), | ||
31 | 'error' => $error, | ||
32 | ); | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * @Route("/login_check", name="_demo_security_check") | ||
37 | */ | ||
38 | public function securityCheckAction() | ||
39 | { | ||
40 | // The security layer will intercept this request | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * @Route("/logout", name="_demo_logout") | ||
45 | */ | ||
46 | public function logoutAction() | ||
47 | { | ||
48 | // The security layer will intercept this request | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @Route("/hello", defaults={"name"="World"}), | ||
53 | * @Route("/hello/{name}", name="_demo_secured_hello") | ||
54 | * @Template() | ||
55 | */ | ||
56 | public function helloAction($name) | ||
57 | { | ||
58 | return array('name' => $name); | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin") | ||
63 | * @Security("is_granted('ROLE_ADMIN')") | ||
64 | * @Template() | ||
65 | */ | ||
66 | public function helloadminAction($name) | ||
67 | { | ||
68 | return array('name' => $name); | ||
69 | } | ||
70 | } | ||
diff --git a/src/Acme/DemoBundle/Controller/WelcomeController.php b/src/Acme/DemoBundle/Controller/WelcomeController.php deleted file mode 100644 index 884f95bb..00000000 --- a/src/Acme/DemoBundle/Controller/WelcomeController.php +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Acme\DemoBundle\Controller; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
6 | |||
7 | class WelcomeController extends Controller | ||
8 | { | ||
9 | public function indexAction() | ||
10 | { | ||
11 | /* | ||
12 | * The action's view can be rendered using render() method | ||
13 | * or @Template annotation as demonstrated in DemoController. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | return $this->render('AcmeDemoBundle:Welcome:index.html.twig'); | ||
18 | } | ||
19 | } | ||