diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-05 21:44:39 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-05 21:44:39 +0100 |
commit | 9bf15f02695823652a0e783c915b039836f51626 (patch) | |
tree | 875efa0d2ec03d4398f98ffdb7e2ac622f40a300 /src/Wallabag/CoreBundle/Controller | |
parent | 2c2308b7830e24409c6f4a52b52a616803b1a515 (diff) | |
download | wallabag-9bf15f02695823652a0e783c915b039836f51626.tar.gz wallabag-9bf15f02695823652a0e783c915b039836f51626.tar.zst wallabag-9bf15f02695823652a0e783c915b039836f51626.zip |
Add listing clients
Rename route to be more consistive (ie: prefixed with developer_)
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/DeveloperController.php | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 30cc8beb..e7720355 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php | |||
@@ -17,13 +17,17 @@ class DeveloperController extends Controller | |||
17 | */ | 17 | */ |
18 | public function indexAction() | 18 | public function indexAction() |
19 | { | 19 | { |
20 | return $this->render('WallabagCoreBundle:Developer:index.html.twig'); | 20 | $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); |
21 | |||
22 | return $this->render('WallabagCoreBundle:Developer:index.html.twig', array( | ||
23 | 'clients' => $clients, | ||
24 | )); | ||
21 | } | 25 | } |
22 | 26 | ||
23 | /** | 27 | /** |
24 | * @param Request $request | 28 | * @param Request $request |
25 | * | 29 | * |
26 | * @Route("/developer/client/create", name="create_client") | 30 | * @Route("/developer/client/create", name="developer_create_client") |
27 | * | 31 | * |
28 | * @return \Symfony\Component\HttpFoundation\Response | 32 | * @return \Symfony\Component\HttpFoundation\Response |
29 | */ | 33 | */ |
@@ -56,7 +60,30 @@ class DeveloperController extends Controller | |||
56 | } | 60 | } |
57 | 61 | ||
58 | /** | 62 | /** |
59 | * @Route("/developer/howto/first-app", name="howto-firstapp") | 63 | * Remove a client. |
64 | * | ||
65 | * @param Request $request | ||
66 | * | ||
67 | * @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client") | ||
68 | * | ||
69 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | ||
70 | */ | ||
71 | public function deleteClientAction(Request $request, Client $client) | ||
72 | { | ||
73 | $em = $this->getDoctrine()->getManager(); | ||
74 | $em->remove($client); | ||
75 | $em->flush(); | ||
76 | |||
77 | $this->get('session')->getFlashBag()->add( | ||
78 | 'notice', | ||
79 | 'Client deleted' | ||
80 | ); | ||
81 | |||
82 | return $this->redirect($this->generateUrl('developer')); | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * @Route("/developer/howto/first-app", name="developer_howto_firstapp") | ||
60 | * | 87 | * |
61 | * @return \Symfony\Component\HttpFoundation\Response | 88 | * @return \Symfony\Component\HttpFoundation\Response |
62 | */ | 89 | */ |