title: Symfony entity class seems not to be a managed Doctrine entity
body: <p>I try to create a form with a dropdown menu which holds all entries of a database table named "main_category".</p>
  
  <p>Here is my TemplateUploadType form:</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;setAction('upload')
          -&gt;setMethod('POST')
  
          -&gt;add('service_category', 'entity', array(
                  'label' =&gt; 'tpl_upload_service_category_label',
                  'class' =&gt; '\AppBundle\Entity\MainCategory',
                  'placeholder' =&gt; 'tpl_upload_service_category_placeholder',
                  'attr' =&gt; array(
                      'required' =&gt; 'true',
                      'class' =&gt; 'form-control'
                  ),
                  'query_builder' =&gt; function (EntityRepository $er) {
                      return $er-&gt;createQueryBuilder('m')
                          -&gt;orderBy('m.serviceCategoryId', 'ASC');
                  },
              )
          )
  
          // button
          -&gt;add('submit', 'submit', array(
                  'attr' =&gt; array(
                      'class' =&gt; 'btn btn-default'
                  )
              )
          );
  }
  </code></pre>
  
  <p>And here is my "MainCategory" entity which I created using the doctrine command line tool:</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * MainCategory
   *
   * @ORM\Table(name="main_category")
   * @ORM\Entity
   */
  class MainCategory
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="service_category_id", type="integer", nullable=false)
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="IDENTITY")
       */
      private $serviceCategoryId;
  
      /**
       * @var string
       *
       * @ORM\Column(name="service_category", type="string", length=50, nullable=false)
       */
      private $serviceCategory = '';
  
      /**
       * @var string
       *
       * @ORM\Column(name="main_category", type="string", nullable=false)
       */
      private $mainCategory = 'SAP';
  
      /**
       * @var string
       *
       * @ORM\Column(name="comment", type="string", length=255, nullable=true)
       */
      private $comment;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       *
       * @ORM\ManyToMany(targetEntity="Costfactor", inversedBy="scid")
       * @ORM\JoinTable(name="category_has_costfactor",
       *   joinColumns={
       *     @ORM\JoinColumn(name="scid", referencedColumnName="service_category_id")
       *   },
       *   inverseJoinColumns={
       *     @ORM\JoinColumn(name="cfid", referencedColumnName="costfactor_id")
       *   }
       * )
       */
      private $cfid;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       *
       * @ORM\ManyToMany(targetEntity="CcRef", inversedBy="serviceCategory")
       * @ORM\JoinTable(name="cc_master",
       *   joinColumns={
       *     @ORM\JoinColumn(name="service_category_id", referencedColumnName="service_category_id")
       *   },
       *   inverseJoinColumns={
       *     @ORM\JoinColumn(name="cc_parameter_id", referencedColumnName="cc_parameter_id")
       *   }
       * )
       */
      private $ccParameter;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       *
       * @ORM\ManyToMany(targetEntity="KpiRef", inversedBy="serviceCategory")
       * @ORM\JoinTable(name="kpi_master",
       *   joinColumns={
       *     @ORM\JoinColumn(name="service_category_id", referencedColumnName="service_category_id")
       *   },
       *   inverseJoinColumns={
       *     @ORM\JoinColumn(name="kpi_parameter_id", referencedColumnName="kpi_parameter_id")
       *   }
       * )
       */
      private $kpiParameter;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       *
       * @ORM\ManyToMany(targetEntity="SecRef", inversedBy="serviceCategory")
       * @ORM\JoinTable(name="sec_master",
       *   joinColumns={
       *     @ORM\JoinColumn(name="service_category_id", referencedColumnName="service_category_id")
       *   },
       *   inverseJoinColumns={
       *     @ORM\JoinColumn(name="sec_parameter_id", referencedColumnName="sec_parameter_id")
       *   }
       * )
       */
      private $secParameter;
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       *
       * @ORM\ManyToMany(targetEntity="SlRef", inversedBy="serviceCategory")
       * @ORM\JoinTable(name="sl_master",
       *   joinColumns={
       *     @ORM\JoinColumn(name="service_category_id", referencedColumnName="service_category_id")
       *   },
       *   inverseJoinColumns={
       *     @ORM\JoinColumn(name="sl_parameter_id", referencedColumnName="sl_parameter_id")
       *   }
       * )
       */
      private $slParameter;
  
      /**
       * Constructor
       */
      public function __construct()
      {
          $this-&gt;cfid = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;ccParameter = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;kpiParameter = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;secParameter = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;slParameter = new \Doctrine\Common\Collections\ArrayCollection();
      }
  
  
      /**
       * Get serviceCategoryId
       *
       * @return integer 
       */
      public function getServiceCategoryId()
      {
          return $this-&gt;serviceCategoryId;
      }
  
      /**
       * Set serviceCategory
       *
       * @param string $serviceCategory
       * @return MainCategory
       */
      public function setServiceCategory($serviceCategory)
      {
          $this-&gt;serviceCategory = $serviceCategory;
  
          return $this;
      }
  
      /**
       * Get serviceCategory
       *
       * @return string 
       */
      public function getServiceCategory()
      {
          return $this-&gt;serviceCategory;
      }
  
      /**
       * Set mainCategory
       *
       * @param string $mainCategory
       * @return MainCategory
       */
      public function setMainCategory($mainCategory)
      {
          $this-&gt;mainCategory = $mainCategory;
  
          return $this;
      }
  
      /**
       * Get mainCategory
       *
       * @return string 
       */
      public function getMainCategory()
      {
          return $this-&gt;mainCategory;
      }
  
      /**
       * Set comment
       *
       * @param string $comment
       * @return MainCategory
       */
      public function setComment($comment)
      {
          $this-&gt;comment = $comment;
  
          return $this;
      }
  
      /**
       * Get comment
       *
       * @return string 
       */
      public function getComment()
      {
          return $this-&gt;comment;
      }
  
      /**
       * Add cfid
       *
       * @param \AppBundle\Entity\Costfactor $cfid
       * @return MainCategory
       */
      public function addCfid(\AppBundle\Entity\Costfactor $cfid)
      {
          $this-&gt;cfid[] = $cfid;
  
          return $this;
      }
  
      /**
       * Remove cfid
       *
       * @param \AppBundle\Entity\Costfactor $cfid
       */
      public function removeCfid(\AppBundle\Entity\Costfactor $cfid)
      {
          $this-&gt;cfid-&gt;removeElement($cfid);
      }
  
      /**
       * Get cfid
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getCfid()
      {
          return $this-&gt;cfid;
      }
  
      /**
       * Add ccParameter
       *
       * @param \AppBundle\Entity\CcRef $ccParameter
       * @return MainCategory
       */
      public function addCcParameter(\AppBundle\Entity\CcRef $ccParameter)
      {
          $this-&gt;ccParameter[] = $ccParameter;
  
          return $this;
      }
  
      /**
       * Remove ccParameter
       *
       * @param \AppBundle\Entity\CcRef $ccParameter
       */
      public function removeCcParameter(\AppBundle\Entity\CcRef $ccParameter)
      {
          $this-&gt;ccParameter-&gt;removeElement($ccParameter);
      }
  
      /**
       * Get ccParameter
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getCcParameter()
      {
          return $this-&gt;ccParameter;
      }
  
      /**
       * Add kpiParameter
       *
       * @param \AppBundle\Entity\KpiRef $kpiParameter
       * @return MainCategory
       */
      public function addKpiParameter(\AppBundle\Entity\KpiRef $kpiParameter)
      {
          $this-&gt;kpiParameter[] = $kpiParameter;
  
          return $this;
      }
  
      /**
       * Remove kpiParameter
       *
       * @param \AppBundle\Entity\KpiRef $kpiParameter
       */
      public function removeKpiParameter(\AppBundle\Entity\KpiRef $kpiParameter)
      {
          $this-&gt;kpiParameter-&gt;removeElement($kpiParameter);
      }
  
      /**
       * Get kpiParameter
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getKpiParameter()
      {
          return $this-&gt;kpiParameter;
      }
  
      /**
       * Add secParameter
       *
       * @param \AppBundle\Entity\SecRef $secParameter
       * @return MainCategory
       */
      public function addSecParameter(\AppBundle\Entity\SecRef $secParameter)
      {
          $this-&gt;secParameter[] = $secParameter;
  
          return $this;
      }
  
      /**
       * Remove secParameter
       *
       * @param \AppBundle\Entity\SecRef $secParameter
       */
      public function removeSecParameter(\AppBundle\Entity\SecRef $secParameter)
      {
          $this-&gt;secParameter-&gt;removeElement($secParameter);
      }
  
      /**
       * Get secParameter
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getSecParameter()
      {
          return $this-&gt;secParameter;
      }
  
      /**
       * Add slParameter
       *
       * @param \AppBundle\Entity\SlRef $slParameter
       * @return MainCategory
       */
      public function addSlParameter(\AppBundle\Entity\SlRef $slParameter)
      {
          $this-&gt;slParameter[] = $slParameter;
  
          return $this;
      }
  
      /**
       * Remove slParameter
       *
       * @param \AppBundle\Entity\SlRef $slParameter
       */
      public function removeSlParameter(\AppBundle\Entity\SlRef $slParameter)
      {
          $this-&gt;slParameter-&gt;removeElement($slParameter);
      }
  
      /**
       * Get slParameter
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getSlParameter()
      {
          return $this-&gt;slParameter;
      }
  }
  </code></pre>
  
  <p>As a result of using above code I recieve the error message:<br>
  Class "\AppBundle\Entity\MainCategory" seems not to be a managed Doctrine entity. Did you forget to map it?</p>
  
  <p>What am I doing wrong? If you need more information please let me know.</p>