symfony - how to do a join in doctrine with createQuiry or DQL -
what want query in doctrine :
select * `reservation` join res_chauf on reservation.reservation_id = res_chauf.reservation_id res_chauf.chauffeur_id =1
in doctrine/symfony2 dql know how select :
$qb = $em->createquerybuilder(); $qb->select('c') ->from('mybundle:client', 'c') ->where('c.name :data') ->orderby('c.name', 'asc') ->setparameter('data', '%'.$data.'%'); $query = $qb->getquery(); $entities = $query->getresult();
but have join 2 tables
some please
thank you
you have use methods join, innerjoin or leftjoin
see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html
best regard
Comments
Post a Comment