title: Symfony Request get all url Parameters
body: <p>I have a <code>Symfony\Component\HttpFoundation\Request</code> object and from it I want to fetch all the url paramethers that provided. In other words when the user visits the <code>http://example.org/soempage?param1=value1&amp;param2=value2&amp;param3=value3</code></p>
  <p>I want to generate an array that has these values <code>['param1','param2','param3']</code> .</p>
  <p>Also I have seen this one: <a href="https://stackoverflow.com/questions/10738647/how-to-get-all-post-parameters-in-symfony2#10739138">How to get all post parameters in Symfony2?</a></p>
  <p>And I tried the following based on above:</p>
  <pre><code>    /**
       * @var request Symfony\Component\HttpFoundation\Request
       */
      $parametersToValidate=$request-&gt;request-&gt;all();
      $parametersToValidate=array_keys($parametersToValidate);
  </code></pre>
  <p>And</p>
  <pre><code>    /**
       * @var request Symfony\Component\HttpFoundation\Request
       */
      $parametersToValidate=$request-&gt;all();
      $parametersToValidate=array_keys($parametersToValidate);
  </code></pre>
  <p>Without the desired result but instead I get this error message:</p>
  <blockquote>
  <p>Attempted to call an undefined method named &quot;all&quot; of class &quot;Symfony\Component\HttpFoundation\Request\</p>
  </blockquote>
  <h1>Edit 1</h1>
  <p>The request I use int into a static method that validates my input. The method is called via the controller and is implemented like that for reusability purposes.</p>
  <pre><code>public static function httpRequestShouldHaveSpecificParametersWhenGiven(Request $request,array $parametersThatHttpRequestShouldHave)
      {
          $parametersToValidate=$request-&gt;parameters-&gt;all();
  
          if(empty($parametersToValidate)){
              return;
          }
          
          $parameters=array_keys($parametersToValidate);
          
          foreach($parameters as $param){
              if(!in_array($parameters,$parametersThatHttpRequestShouldHave)){            
                  throw new InvalidNumberOfParametersException(implode(',',$parametersToValidate),implode(',',$parametersThatHttpRequestShouldHave),implode(',',$diff));
              }
          }
      }
  </code></pre>