Tema: Consulta Dql
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 08/03/2016, 13:41
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 9 meses
Puntos: 379
Respuesta: Consulta Dql

Tu consulta debe de ser algo como esto:
Código PHP:
Ver original
  1. $em = $this->getDoctrine()->getManager();
  2.  
  3.         $query = $em->createQuery(
  4.             'SELECT i, d, s
  5.              FROM VnfqInstComBundle:InstCom i
  6.                JOIN VnfqInstComBundle:District d
  7.                JOIN VnfqInstComBundle:State s
  8.              WHERE i.id = :inst_id
  9.            '
  10.         )->setParameter('inst_Id', $id);
  11.  
  12.         $instCom = $query->getOneOrNullResult();
  13.  
  14.         $instCom->getCity();
  15.         $instCom->getState();

Si quieres que te regrese todos los InstCom con su Distrito y Estado entonces quitas el where y cambias el método getOneOrNullResult() por getResult()
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.