Recently I browsed symfony2 api docs and here is what i’ve found in documentation for Request’s get method:
Avoid using this method in controllers:
- slow
- prefer to get from a "named" source
So what is the "named" source that I should use instead of get method?
“named” source would be appropriate parameter bag:
$request->queryfor GET parameters$request->attributesfor request attributes (parsed from PATH_INFO)$request->requestfor POST parametersgetmethod simply goes through all of them until it finds a parameter by name. Therefore its slow. See the implementation.