<?php
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class TestController extends Controller
{
//Inject Request HTTP Component in your function then able to exploit it
public function myFunctionAction(Request $request)
{
//BASICS
//retrieve $_POST variables from request
$postRequest = $request->request->get('my_data');
//retrieve $_GET variables from request
$getRequest = $request->query->get('my_data');
//get current locale
$locale = $request->getLocale();
}
}
Note that injected Request object applies to current request (it may or may not equal to master request).