Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-999

DQL always needs a FROM clause, should be changed

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Sometimes a developer needs to issue a query without a FROM clause. This especially occurs using the QueryBuilder, when you may or may not have a table to select from, but call a stored procedure always.

      Example:

      $query = $em>createQuery('SELECT (1+1)');
      

      The above query fails because the lexer expects T_FROM. If you replace (1+1) with a stored procedure, this example makes more sense.

      One might argue about that you should use DBAL directly, but I disagree, because it always can happen that you end up in a situation like this:

      $qb = $em->createQueryBuilder();
      
      $qb->select("SOMEFANCYPROCEDURE()");
      
      if ($condition) {
        $qb = $qb->from("additionalTable t");
      }
      

        Activity

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Timo A. Hummel
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: