title: Symfony 2 - Form select options database
body: <p>I'm beginner in Symfony 2.</p>
  
  <p>I'm trying to display a form with a "select" where is the "options" from a query.</p>
  
  <p>I put the following code in my form :</p>
  
  <pre><code>use Doctrine\ORM\EntityRepository;
  use Bloc\MainBundle\Entity\Table;
  use Bloc\MainBundle\Entity\Table2;
  
  public function addAction(Request $request)
  {
      $table = new Table();
      $form = $this-&gt;createFormBuilder($table , array('attr' =&gt; array('role' =&gt; 'form')))
          -&gt;add('num', 'integer', array('label' =&gt; 'Numéro', 'attr' =&gt; array('class' =&gt; 'form-control')))
          -&gt;add('nom_emetteur', 'text', array('label' =&gt; 'Emetteur', 'attr' =&gt; array('class' =&gt; 'form-control')))
          -&gt;add('numero', 'entity', array('class' =&gt; 'BlocMainBundle:Table2', 'property' =&gt; 'numero'))
          ...
  }
  </code></pre>
  
  <p>And I have the following error:</p>
  
  <pre><code>Neither the property "numero" nor one of the methods "getNumero()", "isNumero()", "hasNumero()", "__get()" or "__call()" exist and have public access in class "Bloc\MainBundle\Entity\Table". 
  </code></pre>
  
  <p>I understand that the error tells me that "numero" is not in the entity Table but I question the entity Table2.
  I must miss something, but I do not know where ...</p>
  
  <p>My entity definition looks like this :
  Table 1:</p>
  
  <pre><code>&lt;?php...
  class Table
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="num", type="integer")
       */
      private $num;
  
      //Getter and setter...
  }
  </code></pre>
  
  <p>Table 2</p>
  
  <pre><code>&lt;?php
  
  namespace Bloc\MainBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Fournisseur
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass="Bloc\MainBundle\Entity\Table2Repository")
   */
  class Table2
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="numero", type="integer")
       */
      private $numero;
  
      /**
       * Set numero
       *
       * @param integer $numero
       * @return Fournisseur
       */
      public function setNumero($numero)
      {
          $this-&gt;numero = $numero;
  
          return $this;
      }
  
      /**
       * Get numero
       *
       * @return integer 
       */
      public function getNumero()
      {
          return $this-&gt;numero;
      }
      ...
  }
  </code></pre>
  
  <p>Can you help me please ?</p>