title: Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'ON'
body: <p>I have written the following code for fetching data from database: </p>
  
  <pre><code>function getnotificationAction()
  {
      $session = $this-&gt;getRequest()-&gt;getSession();
      $userId = $session-&gt;get('userid');
  
      $entitymanager = $this-&gt;getDoctrine()-&gt;getEntityManager();
      $notification = $entitymanager-&gt;getRepository('IGCNotificationBundle:Notifications');
      $userNotification = $entitymanager-&gt;getRepository('IGCNotificationBundle:Usernotifications');
      $query = $entitymanager
                   -&gt;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")-&gt;setParameter('userId', userId);
  
      $notifications = $query-&gt;getResult();
  
      return $this-&gt;render('IGCNotificationBundle:Default:notification.html.twig', array('notifications' =&gt; $notifications));
  } }
  </code></pre>
  
  <p>But it is giving:</p>
  
  <blockquote>
    <p>[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 »</p>
  </blockquote>