wallabag/src/Wallabag/ImportBundle/Controller/PocketController.php
Jeremy Benoist 0aa344dc24 Update url & service name
Prefix ur with service namel: [service]_[route name]
Add comment in Interface
2016-01-02 23:27:41 +01:00

43 lines
1.1 KiB
PHP

<?php
namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class PocketController extends Controller
{
/**
* @Route("/import/pocket", name="pocket_import")
*/
public function indexAction()
{
return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
}
/**
* @Route("/import/pocket/auth", name="pocket_auth")
*/
public function authAction()
{
$pocket = $this->get('wallabag_import.pocket.import');
$authUrl = $pocket->oAuthRequest(
$this->generateUrl('import', array(), true),
$this->generateUrl('pocket_callback', array(), true)
);
return $this->redirect($authUrl, 301);
}
/**
* @Route("/import/pocket/callback", name="pocket_callback")
*/
public function callbackAction()
{
$pocket = $this->get('wallabag_import.pocket.import');
$accessToken = $pocket->oAuthAuthorize();
$pocket->import($accessToken);
return $this->redirect($this->generateUrl('homepage'));
}
}