错误:预期原则\ORM\查询\词法分析器::T_WITH,得到“ON”
2022-08-30 19:46:03
我编写了以下代码用于从数据库获取数据:
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));
} }
但它正在给予:
[语法错误] 第 0 行,列 203:错误:预期原则\ORM\Query\词法分析器::T_WITH,获取“ON” 500 内部服务器错误 - 查询异常 1 链接异常:查询异常 »