我在我的 symfony2 项目中尝试过:
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery(
'SELECT v.voiture,o.offre,m.marque
FROM FrontOfficeBundle:Voiture v
INNER JOIN FrontOfficeBundle:OffreSpecial o on o.voiture_id = v.id
INNER JOIN FrontOfficeBundle:Marque m on m.id = v.marque_id'
);
$result = $query->getResult();
并得到那个错误:
[Syntax Error] line 0, col 122: Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'on'
甚至 SQL 查询都是正确的!请帮助