Question

What i want is to do is this query in doctrine :

SELECT *
FROM `reservation`
JOIN res_chauf ON reservation.reservation_id = res_chauf.reservation_id
WHERE res_chauf.chauffeur_id =1

in doctrine/symfony2 with DQL i know how to do just a select like this :

$qb = $em->createQueryBuilder();
$qb->select('c')
  ->from('myBundle:Client', 'c')
  ->where('c.name LIKE :data')
  ->orderBy('c.name', 'ASC')
  ->setParameter('data', '%'.$data.'%');
   $query = $qb->getQuery();  
   $entities = $query->getResult();

but now i have to join two tables

some help please

Thank you

No correct solution

OTHER TIPS

you have to use methods like join, innerJoin or leftJoin

see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html

Best regard

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top