title: Changing the Request, retrieving data from the Session
body: <p>Scenario:</p>
  
  <ul>
  <li>I have no AJAX.</li>
  <li>I have a search form with <code>GET</code> method and <code>csrf_protection</code> disabled that filters the entities showed and paginated in <code>myEntityListAction</code>, reachable at the uri <code>/myapp/myentity/list</code></li>
  <li>The user opens <code>/myapp/myentity/list</code>, submit the filter form and goes to page 2. He is now on <code>/myapp/myentity/list?entity_filter[search]=something&amp;page=2</code></li>
  <li>The user open another page (let's say the detail of one of the shown entities) and then clicks on <code>/myapp/myentity/list</code></li>
  </ul>
  
  <p>I want him to see the page <code>/myapp/myentity//list?entity_filter[search]=something&amp;page=2</code></p>
  
  <p>I'm trying to make the filters sticky to the user's session, so that when the user re-opens <code>/myapp/myentity/list</code> without any parameter he gets the last seen result, with the same filters and page number.</p>
  
  <p>I followed this approach but I think it's highly deprecated because i am modifying the <code>$request</code> object and the <code>$_GET</code> superglobal (due to the pagination library that uses directly $_GET), despite it works.</p>
  
  <pre><code>/**
   * @Route("/myapp/myentity/list",  name="entity_list")
   * @Method({"GET"})
   */
  public function myEntityListAction(Request $request) {
      if (0===$request-&gt;query-&gt;count()) { //querystring is empty
          $prev_query=$request-&gt;getSession()-&gt;get('my_entity_list', null);
          if ($prev_query) { //is there something in session?
              $_GET=$prev_query;
              $original_request=$request;
              $request=$request-&gt;createFromGlobals();
              $request-&gt;setSession($original_request-&gt;getSession());
          }
      } else { //i have something in my querystring
          $request-&gt;getSession()-&gt;set('my_entity_list', $request-&gt;query-&gt;all()); //i store it in session
      }
      //...do the other stuff (form, filters, pagination, etc)
  }
  </code></pre>
  
  <p>I think that i will follow another approach, redirecting the user to <code>/myapp/myentity/list?entity_filter[search]=something&amp;page=2</code> (reading from the session) so that i don't have to modify either <code>$_GET</code> or <code>$request</code>.</p>
  
  <p>Here comes the question: How could I safely edit the $request to inject or change something I need without doing a redirect? Could I safely do it with a subrequest?</p>