I was going through some code in symfony, and I found
$request->request->replace()
Actually, a form is posted and its value is fetched in a function say,
public function someFunction(Request $request){
$data = $request->request->all() ? : json_decode($request->getContent(), true);
$request->request->replace($data);
}
When I dumped,
$request->request->replace($data)
The result is null. I didn't understand why is it used and what are its benefits?
I searched about it, some say it is used to sanitise the data, some say we should not use it as replaces all of the parameters in the request instead we should use set method.
And I did not get any of it as I am new to symfony.
What does $request->request->replace() does with the parameter provided to it?