title: Symfony 1.4: Unable to set session variables
body: <p>I am trying to setup a symfony session variable that I can access across all my actions/templates. This is done once the user credentials have been validated, the user authenticated but before he is redirected to his homepage.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>// Authentication verified 
  
  $this-&gt;getUser()-&gt;setAuthenticated(true);
  // note I am deliberately using a static value
  $this-&gt;getUser()-&gt;setAttribute('userid',"4"); 
  $this-&gt;redirect('flashcard/index');  
  </code></pre>
  
  <p>When I attempt to get this attribute in one of my actions, like this:</p>
  
  <p><code>$this-&gt;getUser()-&gt;getAttribute('userid')</code> it returns null, </p>
  
  <p>I take a <code>var_dump</code> like this:</p>
  
  <pre><code>var_dump($this-&gt;getUser()-&gt;getAttributeHolder()-&gt;getAll());
  </code></pre>
  
  <p>and it returns an empty array, which means something is not quite correct. </p>
  
  <p>As a heads up, I am not using sfDoctrineGuard for login authentication, although I don't think setting session variables will have anything to do with it.</p>