3 namespace Wallabag\CoreBundle\Controller
;
5 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
;
6 use Symfony\Component\HttpFoundation\Request
;
7 use Symfony\Bundle\FrameworkBundle\Controller\Controller
;
8 use Wallabag\ApiBundle\Entity\Client
;
9 use Wallabag\CoreBundle\Form\Type\ClientType
;
11 class DeveloperController
extends Controller
14 * @Route("/developer", name="developer")
16 * @return \Symfony\Component\HttpFoundation\Response
18 public function indexAction()
20 return $this->render('WallabagCoreBundle:Developer:index.html.twig');
24 * @param Request $request
26 * @Route("/developer/client/create", name="create_client")
28 * @return \Symfony\Component\HttpFoundation\Response
30 public function createClientAction(Request
$request)
32 $em = $this->getDoctrine()->getManager();
33 $client = new Client();
34 $clientForm = $this->createForm(ClientType
::class, $client);
35 $clientForm->handleRequest($request);
37 if ($clientForm->isValid()) {
38 $client->setAllowedGrantTypes(array('token', 'authorization_code'));
39 $em->persist($client);
42 $this->get('session')->getFlashBag()->add(
47 return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array(
48 'client_id' => $client->getPublicId(),
49 'client_secret' => $client->getSecret(),
53 return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
54 'form' => $clientForm->createView(),
59 * @Route("/developer/howto/first-app", name="howto-firstapp")
61 * @return \Symfony\Component\HttpFoundation\Response
63 public function howtoFirstAppAction()
65 return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig');