title: Define custom repository class using Doctrine in Symfony2
body: <p>I'm having issue with defining a custom repository class in symfony in order to use some custom queries (method User::checkUser()).</p>
  
  <p>Here is the repository class code</p>
  
  <pre><code>&lt;?php
  namespace TDDumb\FEBundle\Entity;
  use Doctrine\ORM\Mapping as ORM;
  use Doctrine\ORM\EntityRepository;
  /**
   *
   *  @ORM\Entity(repositoryClass="TDDumb\FEBundle\Entity\UserRepository")
   *  @ORM\Table(name="user")
   *
   */
  
  class User extends EntityRepository{
      public function __construct(){
      }
      /**
       *
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
      /**
       *
       * @ORM\Column(type="string", length=16)
       */
      protected $userID;
      /**
       *
       * @ORM\Column(type="string", length=16)
       */
      protected $password;
  
  
  [GETTER AND SETTER...]
  
      public function checkUser(){
          return $this-&gt;getEntityManager()-&gt;createQuery("SELECT u FROM TDDumbFEBundle:user u WHERE u.userID = '{$this-&gt;userID}' AND u.password = '{$this-&gt;password}'")-&gt;getResult();
      }
  }
  </code></pre>
  
  <p>and here is my controller code:</p>
  
  <pre><code>public function loginAction(Request $request){
          $user = new User();
  
          $form = $this-&gt;createFormBuilder($user)
          -&gt;add('userID', 'text', array('label' =&gt; 'UserID'))
          -&gt;add('password', 'password', array('label' =&gt; 'Password'))
          -&gt;add('ricorda', 'checkbox', array(
                  "required" =&gt; false,
                  "mapped" =&gt; false
          ))
          -&gt;add('login', 'submit')-&gt;getForm();
  
          $form-&gt;handleRequest($request);
  
          if($form-&gt;isValid()){
              //$dbUser = $this-&gt;getDoctrine()-&gt;getRepository('TDDumbFEBundle:User')-&gt;findOneByUserID($user-&gt;getUserID());
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $res = $em-&gt;getRepository('TDDumbFEBundle:User')-&gt;checkUser();
              Debug::dump($res);
          }
          return $this-&gt;render('TDDumbFEBundle:Default:auth.html.twig', array('form' =&gt; $form-&gt;createView()));
      }
  </code></pre>
  
  <p>I cannot understand why I always get this error:</p>
  
  <pre><code>FatalErrorException: Error: Class 'TDDumb\FEBundle\Entity\UserRepository' not found in /var/www/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 689
  </code></pre>
  
  <p>Which points to the mapping definition in the class file:</p>
  
  <pre><code>@ORM\Entity(repositoryClass="TDDumb\FEBundle\Entity\UserRepository")
  </code></pre>
  
  <p>Which is correct, I suppose</p>