devo scrivere seguente codice per il recupero dei dati dal databaseErrore: Previsto Doctrine ORM Query Lexer :: T_WITH, ha 'ON'
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));
} }
ma è 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 »
Bisogno il vostro aiuto Grazie in anticipo
può essere rimuovere '' AS' IGCNotificationBundle: Notifiche n ENTRA IGCNotificationBundle: Usernotifications u' – zzlalani
Ciao grazie per la risposta ho provato questo, ma di fronte lo stesso errore –
Per quanto vedo che stai cercando di eseguire 'SQL' ... è necessario riscriverlo a' DQL' (Docrine Query Language). Per favore aggiorna la tua domanda con la struttura delle entità ... –