title: Getting session ID with $session->getId() returns an empty result in Symfony2
body: <p>I want to getting session ID to store it in the database (because I store shopping carts in my database). Thereby, I want to get session ID, with this method:</p>
  
  <pre><code>$session = $this-&gt;get('session');
  $carts-&gt;setSessionId($session-&gt;getId());
  </code></pre>
  
  <p>But this method returns an empty result. It's really weird because if I send this ID in my view with, for exemple:</p>
  
  <pre><code>'session' =&gt; $session-&gt;getId(),
  </code></pre>
  
  <p>It works... It's really strangely ; have I make an error in my code?</p>
  
  <p>getSessionId() and setSessionId() functions:</p>
  
  <pre><code>/**
   * Set sessionId
   *
   * @param string $sessionId
   * @return Carts
   */
  public function setSessionId($sessionId)
  {
      $this-&gt;sessionId = $sessionId;
  
      return $this;
  }
  
  /**
   * Get sessionId
   *
   * @return string 
   */
  public function getSessionId()
  {
      return $this-&gt;sessionId;
  }
  </code></pre>
  
  <p>Thank you per advance!</p>