Q:

Symfony2 : how i get if variable post exist

I will try to verify if one variable POST exist but my function is not recognize.
$request = $this->get('request');

if($request->has('variable')){
// do something
}

But the function has is not implement into request but i have seen is implement into parameterBag.
So i don't know how use parameterBag.
I have try to search in google but all solution is to use 
"$request->has('variable')"
or
$request->hasParameter('variable')

But has and hasParameter is not a function in request ...
Thanks for help,
regards,
Jérôme

A:

POST variables are stored in $request->request (the naming is confusing). try this,
if ($request->request->has('variable')) {
    //do something
}

Keep in mind that each property of your Request is a ParameterBag instance (or a sub-class of). The point here is to target the request property (which holds the POST data)

