title: Check whether user is logged in symfony
body: <p>I am using symfony 1.4.8 and Propel as ORM. To create a login system I am using sfGuardPlugin. I have configured everything, and the login system is working. But I have a problem in getting the sfGuard user data such as sfGuardUser id, and on login I am getting the back button problem; as I login and press the back button, it again shows the Login Page.</p>
  
  <p>Here is the code that I am using in the view to check whether the user is logged in:</p>
  
  <pre><code>&lt;?php if($sf_user-&gt;isAuthenticated()): ?&gt;
           &lt;?php echo link_to('Logout', '/logout') ?&gt;
  &lt;?php else: ?&gt;
           &lt;?php echo link_to('Login', '/login') ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>and if I use this method to get sfGuardUser id:</p>
  
  <pre><code>if($this-&gt;getUser())
  {
      $login_id=$this-&gt;getUser();
      $c=new Criteria();
      $c-&gt;add(SfGuardUserPeer::USERNAME,$login_id);
      $sf_guard_user=SfGuardUserPeer::doSelectOne($c);
      if($sf_guard_user)
      {
          $sf_id=$sf_guard_user-&gt;getId();          
  
      }
  }
  </code></pre>
  
  <p>it gives me the error:</p>
  
  <blockquote>
    <p>(Fatal error: Nesting level too deep - recursive dependency? in D:\development\sfprojects\proj\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\util\DebugPDOStatement.php on line 124) </p>
  </blockquote>