title: symfony2 createQueryBuilder
body: <p>I am trying to make a really simple sql query from repository class, just <code>select * from Adjudicacion where cursoAcademico_id=$cursoAcademicoActual;</code>:</p>
  
  <p>This is my entity:</p>
  
  <pre><code>/**
  * Adjudicacion
  *
  * @ORM\Table(name="Adjudicacion")
  * @ORM\Entity(repositoryClass="Administrador\AdjudicacionBundle\Entity\AdjudicacionRepository")
  */
  class Adjudicacion {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="fechaInicio", type="date")
       */
      private $fechaInicio;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="fechaFinal", type="date")
       */
      private $fechaFinal;
  
  
      /**
       * @ORM\ManyToOne(targetEntity="Administrador\CursoAcademicoBundle\Entity\CursoAcademico")
       */
      private $cursoAcademico;
  
  
      /**
       * @ORM\ManyToOne(targetEntity="Administrador\AdjudicacionClaseBundle\Entity\AdjudicacionClase")
       */
      private $adjudicacionClase;
  
  
      /**
       * @ORM\ManyToOne(targetEntity="Administrador\AdjudicacionNumeroBundle\Entity\AdjudicacionNumero")
       */
      private $adjudicacionNumero;
  
  
      /**
       * @ORM\ManyToOne(targetEntity="Administrador\AdjudicacionTipoBundle\Entity\AdjudicacionTipo")
       */
      private $adjudicacionTipo;
  
  ...getters and setters...
  </code></pre>
  
  <p>This is my repository class:</p>
  
  <pre><code>class AdjudicacionRepository extends EntityRepository {
  
  public function findAdjudicacionesActuales($cursoAcademicoActual) {
  
      $q=$this-&gt;createQueryBuilder('c')
      -&gt;where('c.cursoAcademico_id = :cursoAcademico_id')
      -&gt;setParameter('cursoAcademico_id', $cursoAcademicoActual)
      -&gt;getQuery()-&gt;getResult();
  
      return $q;
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But it doesnt work, the screen is just blank and I dont get any result. I tried with criteria too, like this:</p>
  
  <pre><code>public function findAdjudicacionesActuales2($cursoAcademicoActual) {
  
      $expr = Criteria::expr();
      $criteria = Criteria::create();
      $criteria-&gt;where($expr-&gt;eq("cursoAcademico_id", $cursoAcademicoActual));
      return $this-&gt;matching($criteria);      
  
  }
  </code></pre>
  
  <p>and i get: <code>Unrecognized field: cursoAcademico_id</code></p>
  
  <p>This is in the database:</p>
  
  <pre><code>mysql&gt; select * from Adjudicacion;
  +----+-------------+------------+-------------------+----------------------+-----------------------+---------------------+
  | id | fechaInicio | fechaFinal | cursoAcademico_id | adjudicacionClase_id | adjudicacionNumero_id | adjudicacionTipo_id |
  +----+-------------+------------+-------------------+----------------------+-----------------------+---------------------+
  |  2 | 2009-01-01  | 2009-01-01 |                 7 |                    3 |                     4 |                   3 |
  |  6 | 2009-01-01  | 2009-01-01 |                 7 |                    3 |                     4 |                   4 |
  |  7 | 2009-01-01  | 2009-01-01 |                 7 |                    3 |                     5 |                   3 |
  |  8 | 2009-01-01  | 2009-01-01 |                 7 |                    3 |                     5 |                   4 |
  +----+-------------+------------+-------------------+----------------------+-----------------------+---------------------+
  </code></pre>
  
  <p>what is wrong?</p>