Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify Value of Parameters of Request

Tags:

symfony

I want to know if it is possible to modify the value of the parameter of the request.

But i don't know how to do this.

I try with

$requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype'); 

Next I use

$request->request->replace() 

But I don't how to use this method in my case.

Thanks

like image 331
JeremyP Avatar asked May 22 '12 18:05

JeremyP


1 Answers

The replace method replaces all of the parameters in the request, so you probably do not want to do that.

I would use the set method instead - So you can do:

$request->request->set('tactill_customerbundle_customertype', $newValue) 

You can read more in the Symfony2 documentation (http://api.symfony.com/2.0/) - you are looking for Symfony\Component\HttpFoundation\Request (which is the $request variable), which then returns a Symfony\Component\HttpFoundation\ParameterBag when you call the request() method.

like image 90
Jeppe Mariager-Lam Avatar answered Sep 20 '22 08:09

Jeppe Mariager-Lam