错误:预期的Doctrine\ORM\Query\Lexer :: T_WITH,得到'ON' [英] Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'ON'

查看:318
本文介绍了错误:预期的Doctrine\ORM\Query\Lexer :: T_WITH,得到'ON'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了从数据库中获取数据的以下代码

I have write following code for fetching data from database

 function getnotificationAction() {
    $session = $this->getRequest()->getSession();
    $userId = $session->get('userid');

    $entitymanager = $this->getDoctrine()->getEntityManager();
    $notification = $entitymanager->getRepository('IGCNotificationBundle:Notifications');
    $userNotification = $entitymanager->getRepository('IGCNotificationBundle:Usernotifications');
    $query = $entitymanager->createQuery("SELECT n.notificationid, n.title,n.notificationmessage, u.creationdate, u.notificationid, u.messagestatus From IGCNotificationBundle:Notifications AS n JOIN IGCNotificationBundle:Usernotifications AS u ON u.notificationid = n.notificationid WHERE u.userId = :userId ORDER BY n.creationdate DESC")->setParameter('userId', userId);

    $notifications = $query->getResult();

    return $this->render('IGCNotificationBundle:Default:notification.html.twig', array('notifications' => $notifications));
} }

但它是givin

[Syntax Error] line 0, col 203: Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'ON' 500 Internal Server Error - QueryException 1 linked Exception: QueryException »

需要帮助
提前感谢

Need your help Thanks in advance

推荐答案

[Syntax Error] line 0, col 203: Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'ON' 500 Internal Server Error - QueryException 1 linked Exception: QueryException »

我认为你应该用'WITH'替换你的关键字'ON'。

I think you should replace your keyword 'ON' with a 'WITH' .

从doc提取


现在可以在DQL中使用
语法 FROM Foo f JOIN Bar b WITH f.id = b .id

这篇关于错误:预期的Doctrine\ORM\Query\Lexer :: T_WITH,得到'ON'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆