Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. $query = $this->createQueryBuilder('o');
  2. $query->select('o');
  3. $query->leftJoin(Pais::class, 'p', 'with', 'o.idPais = p.id');
  4. $query->leftJoin( Contrato::class, 'c', 'with', 'o.idTipoContrato = c.id');
  5. $query->andWhere('p.nombreCorto = :pais');
  6. $query->andWhere('o.activa = 1');
  7. $query->andWhere('o.eliminado is NULL');
  8. $query->andWhere('o.caducidad > :hoy');
  9. $query->setParameter('pais', $pais)->setParameter('hoy', new DateTime());
  10.  
  11. return $query->getQuery()->getArrayResult();
  12.  
  13. /**
  14. * @var ApplicationEntityPais
  15. *
  16. * @ORMManyToOne(targetEntity="ApplicationEntityPais")
  17. * @ORMJoinColumns({
  18. * @ORMJoinColumn(name="id_pais", referencedColumnName="id", nullable=true)
  19. * })
  20. */
  21. private $idPais;
  22.  
  23.  
  24. /**
  25. * @var ApplicationEntityTipoContrato
  26. *
  27. * @ORMManyToOne(targetEntity="ApplicationEntityTipoContrato")
  28. * @ORMJoinColumns({
  29. * @ORMJoinColumn(name="id_tipo_contrato", referencedColumnName="id", nullable=true)
  30. * })
  31. */
  32. private $idTipoContrato;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement