title: Getting "cannot refresh user" error with symfony2 and doctrine
body: <p>I have the class User as the base class then i extended Teacher from user class.</p>
  
  <p>When i try to login i get this error</p>
  
  <blockquote>
    <p>You cannot refresh a user from the EntityUserProvider that does not
    contain an identifier. The user object has to be serialized with its
    own identifier mapped by Doctrine.</p>
  </blockquote>
  
  <p>I have serialize/deserialize function in user.php as i have coped that from FOSUserbundle</p>
  
  <pre><code>public function serialize()
      {
          return serialize(array(
              $this-&gt;password,
              $this-&gt;salt,
              $this-&gt;usernameCanonical,
              $this-&gt;username,
              $this-&gt;expired,
              $this-&gt;locked,
              $this-&gt;credentialsExpired,
              $this-&gt;enabled,
          ));
      }
  </code></pre>
  
  <p>I am not able to find where i can check for error. i am stuck. please help</p>