Created
February 15, 2017 14:41
-
-
Save MikSDigital/0810a567edff7c1470c81a299d5b38e3 to your computer and use it in GitHub Desktop.
UserSubscribe controller, Class ApiUserSubscriptionController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Manager\ManagerBundle\Controller\Management; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use FOS\RestBundle\View\View; | |
/** | |
* Class ApiUserSubscriptionController | |
* | |
*/ | |
class ApiUserSubscriptionController extends Controller | |
{ | |
/** | |
* @Route("api/subscribe", name="subscribe", defaults={"_format":"json"}) | |
* @Template() | |
* @Method({"POST"}) | |
*/ | |
public function subscribeUserAction(Request $oRequest) | |
{ | |
if ($oRequest->getMethod() == 'POST') | |
{ | |
return $this->get('fos_rest.view_handler') | |
->handle( | |
View::create() | |
->setStatusCode(200) | |
->setData(array( | |
'language'=>$oRequest->getLanguages(), | |
'fields' =>$oRequest->request->all() | |
)) | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment