title: Error "The user provider must return a UserInterface object" with Symfony2 login
body: <p>I am trying to modify existing demo login, which comes with symfony, from in_memory to db storage of users. I am still getting:</p>
  
  <pre><code>[2013-03-27 19:24:34] security.INFO: Authentication request failed: The user provider must return a UserInterface object. [] []
  </code></pre>
  
  <p>So I changed:<br /></p>
  
  <p><code>security.yml</code></p>
  
  <pre><code>  providers:
    user_db:
          entity: { class: Cremesk\AgentisBundle\Entity\Pouzivatel, property: meno }
  </code></pre>
  
  <p>Also created mentioned Entity:</p>
  
  <pre><code>'use Doctrine\ORM\Mapping as ORM;
   use Symfony\Component\Security\Core\User\UserInterface;
  
   /**
   * Pouzivatel
   *
   * @ORM\Table('pouzivatel')
   * @ORM\Entity
   */
   class Pouzivatel implements UserInterface
   .etc
  </code></pre>
  
  <p>and left controller as it was:</p>
  
  <pre><code> use Symfony\Bundle\FrameworkBundle\Controller\Controller;
   use Symfony\Component\Security\Core\SecurityContext;
   use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
   use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
   use JMS\SecurityExtraBundle\Annotation\Secure;
  
  
   /**
    * @Route("/demo/secured")
    */
   class SecuredController extends Controller
   {
       /**
        * @Route("/login", name="_demo_login")
        * @Template()
        */
       public function loginAction()
       {
           if ($this-&gt;get('request')-&gt;attributes-&gt;has(SecurityContext::AUTHENTICATION_ERROR)) {
          $error = $this-&gt;get('request')-&gt;attributes-&gt;get(SecurityContext::AUTHENTICATION_ERROR);
      } else {
          $error = $this-&gt;get('request')-&gt;getSession()-&gt;get(SecurityContext::AUTHENTICATION_ERROR);
      }
  
      return array(
          'last_username' =&gt; $this-&gt;get('request')-&gt;getSession()-&gt;get(SecurityContext::LAST_USERNAME),
          'error'         =&gt; $error,
      );
  }
  
  /**
   * @Route("/login_check", name="_security_check")
   */
  public function securityCheckAction()
  {
      // The security layer will intercept this request
  }
  
  /**
   * @Route("/logout", name="_demo_logout")
   */
  public function logoutAction()
  {
      // The security layer will intercept this request
  }
  
  /**
   * @Route("/hello", defaults={"name"="World"}),
   * @Route("/hello/{name}", name="_demo_secured_hello")
   * @Template()
   */
  public function helloAction($name)
  {
      return array('name' =&gt; $name);
  }
  
  /**
   * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
   * @Secure(roles="ROLE_ADMIN")
   * @Template()
   */
  public function helloadminAction($name)
  {
      return array('name' =&gt; $name);
  }
   }
  </code></pre>
  
  <p>I am not able to make login working. 
  Will appreciate any kind of help. Thank you.</p>