Doctrine2/ZF2 Requete avec Join
Bonjour à tous,
J'utilise Doctrine2 avec ZF2 et j'ai besoin de faire une requête SQL du type :
Code:
SELECT * FROM table1 JOIN table2 ON table1.champ1 = table2.champ2 WHERE table1.champ3 = 1 ;
je ne vois pas du tout comment faire ça avec mes entitées. J'ai essayé des trucs comme ça mais j'ai des erreurs.
Citation:
(Object of class Doctrine\\ORM\\EntityRepository could not be converted to string in /home/zf2/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Join.php on line 141)
Code:
1 2 3 4 5
| $resultsCom = $this->getEntityManager()->getRepository('\Module\Entity\Table1')->createQueryBuilder('a')
->innerJoin($this->getEntityManager()->getRepository('\Module\Entity\Table2'), 's', 'ON', 'a.champ1 = s.champ2')
->where('a.champ3=1')
->getQuery()
->getResult(); |
Je ne sais pas comment faire pour spécifier mon entité dans la requête.
Merci d'avance