title: Mapping Exception error with Doctrine in Symfony2
body: <p>i need your help because it's like a day i'm stuck with a mapping problem in Symfony 2.</p>
  
  <p>First of all, i'm new to Symfony, i have only 2 weeks of practice with that framework.
  So let's talk about my real problem. The synopsis is simple, i have a very simple form that i use to create a categorie (CD/DVD/Books, etc..). So normally,my page displays all categorie that already exists and i input a new categorie (like BLU-RAY for ie), then that categorie is saved on my database named Categorie with these attributes (idcategorie=BLU-RAY, idcatalogue=CAT01).</p>
  
  <p>That's the normal situation, in my case, i can list list all my categorie but when i submit my form, i've got a beautiful </p>
  
  <blockquote>
    <p>The class 'Doctrine\ORM\EntityRepository' was not found in the chain
    configured namespaces SEBO\BackOfficeBundle\Entity</p>
  </blockquote>
  
  <p>First this my controller</p>
  
  <pre><code>public function categorieAction(Request $request)
  {
      $categorie = $this-&gt;getDoctrine()
          -&gt;getRepository('SEBOBackOfficeBundle:Categorie');
      $listeCategorie = $categorie-&gt;findAll();
  
      $newCategorie = new Categorie();
      $newCategorie-&gt;setIdcatalogue('CAT01');
  
      $form = $this-&gt;createFormBuilder($newCategorie)
          -&gt;add('idcategorie', 'text')
          -&gt;add('Ajouter', 'submit')
          -&gt;getForm();
  
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isValid()) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($categorie);
          $em-&gt;flush();
  
          $request-&gt;getSession()-&gt;getFlashBag()-&gt;add('notice', 'Catégorie bien enregistrée.');
  
          return $this-&gt;redirect($this-&gt;generateUrl('sebo_back_office_categorie', array(
              'listeCategorie' =&gt; $listeCategorie,
              'form' =&gt; $form-&gt;createView(),
          )));
      }
  
      $content = $this-&gt;get('templating')-&gt;render('SEBOBackOfficeBundle:Advert:categorie.html.twig', array(
          'listeCategorie' =&gt; $listeCategorie,
          'form' =&gt; $form-&gt;createView()
      ));
      return new Response($content);
  }
  </code></pre>
  
  <p>This is my class Categorie.php</p>
  
  <pre><code>namespace SEBO\BackOfficeBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
  * Categorie
  *
  * @ORM\Table(name="categorie", indexes={@ORM\Index(name="FK_Catalogue_IdCatalogue", columns={"IdCatalogue"})})
  * @ORM\Entity
  */
  class Categorie
  {
  /**
   * @var string
   *
   * @ORM\Column(name="IdCategorie", type="string", length=40, nullable=false)
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="IDENTITY")
   */
  private $idcategorie;
  
  /**
   * @var \Catalogue
   *
   * @ORM\ManyToOne(targetEntity="Catalogue")
   * @ORM\JoinColumns({
   *   @ORM\JoinColumn(name="IdCatalogue", referencedColumnName="IdCatalogue")
   * })
   */
  private $idcatalogue;
  
  
  
  /**
   * Get idcategorie
   *
   * @return string 
   */
  public function getIdcategorie()
  {
      return $this-&gt;idcategorie;
  }
  
  /**
   * Set idcatalogue
   *
   * @param string $idcatalogue
   * @return Categorie
   */
  public function setIdcatalogue($idcatalogue)
  {
      $this-&gt;idcatalogue = $idcatalogue;
  
      return $this;
  }
  
  /**
   * Set idcategorie
   *
   * @param string $idcategorie
   * @return Categorie
   */
  public function idcategorie($idcategorie)
  {
      $this-&gt;idcategorie = $idcategorie;
  
      return $this;
  }
  
  /**
   * Get idcatalogue
   *
   * @return \SEBO\BackOfficeBundle\Entity\Catalogue 
   */
  public function getIdcatalogue()
  {
      return $this-&gt;idcatalogue;
  }
  }
  </code></pre>
  
  <p>and that's my Doctrine/ORM xml file for Categorie.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"&gt;
    &lt;entity name="Categorie" table="categorie"&gt;
      &lt;indexes&gt;
        &lt;index name="FK_Catalogue_IdCatalogue" columns="IdCatalogue"/&gt;
      &lt;/indexes&gt;
      &lt;id name="idcategorie" type="string" column="IdCategorie" length="40"&gt;
        &lt;generator strategy="IDENTITY"/&gt;
      &lt;/id&gt;
  &lt;many-to-one field="idcatalogue" target-entity="Catalogue"&gt;
    &lt;join-columns&gt;
      &lt;join-column name="IdCatalogue" referenced-column-name="IdCatalogue"/&gt;
    &lt;/join-columns&gt;
  &lt;/many-to-one&gt;
   &lt;/entity&gt;
  &lt;/doctrine-mapping&gt;
  </code></pre>
  
  <p>Everything works fine until i submit, i can see my list of categorie but after a lot of search, i still can't see what's that  class 'Doctrine\ORM\EntityRepository', i've surely missed a thing and i hope you will help.
  Thanks for your future answer.</p>