title: Symfony2 Cookie Problems when trying to get the cookie
body: <p>I'm having difficulties in managing Cookies in Symfony2.</p>
  
  <p>All my data is manipulated in an Controller used as service for another Controller (I have tested outside this controller and I have the same issue).</p>
  
  <p>I use the followings:</p>
  
  <pre><code>use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Cookie;
  </code></pre>
  
  <p>To set a Cookie, I use <strong>Cookie()</strong> and <strong>Response()</strong></p>
  
  <pre><code>public function indexAction()
  {
  
      $cookie     = new Cookie('mycookie', 'myvalue' );
      $response   = new Response();
      $response-&gt;headers-&gt;setCookie( $cookie );
      $response-&gt;send();
  
      return $this-&gt;render('MyBundle:Default:default.html.twig', array());
  
  }
  </code></pre>
  
  <p>All is ok here, I can view the Cookie dumping a <strong>$_COOKIE</strong> var and I can see it using various browser plugins. But the problem is that I cannot read/get it.</p>
  
  <p>I tried 2 methods, none of them were successful.</p>
  
  <pre><code>public function readAction()
  {
  
      // Method 1
      $request = new Request;
      $cookies = $request-&gt;cookies;
      var_dump( $cookies-&gt;get('mycookie') );
  
      // Method 2
      $response = new Response();
      $cookies = $response-&gt;headers-&gt;getCookies();
      var_dump($cookies);
  
      // Return My Response
  
  }
  </code></pre>
  
  <p>Any ideas what am I doing wrong here?
  To be noticed that I am just starting using Symfony2.</p>