Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-234

CLONE -createQueryBuilder does not insert alias into "from" part

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.0-ALPHA4
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      When using createQueryBuilder() the dql created throws an error when executed:

      Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got 'LEFT'

      The dql created is missing the alias after "from".

        Activity

        Hide
        Valery Dubrava added a comment -

        The same issue in trunk

        Show
        Valery Dubrava added a comment - The same issue in trunk
        Hide
        Guilherme Blanco added a comment -

        You must define an alias for all situations (update and select queries included).

        Closing ticket. If I made something wrong, reopen it and provide more informations.

        Thanks

        Show
        Guilherme Blanco added a comment - You must define an alias for all situations (update and select queries included). Closing ticket. If I made something wrong, reopen it and provide more informations. Thanks
        Hide
        Valery Dubrava added a comment -

        Thanks for fix, but it is not all. Please, look at EntityRepository->createQueryBuilder method. Specified alias is not pushed into 'from' method. I suggest:

        public function createQueryBuilder($alias)
        {
           return $this->_em->createQueryBuilder()
                ->select($alias)
                ->from($this->_entityName, $alias); //the second parameter lost
        }
        
        Show
        Valery Dubrava added a comment - Thanks for fix, but it is not all. Please, look at EntityRepository->createQueryBuilder method. Specified alias is not pushed into 'from' method. I suggest: public function createQueryBuilder($alias) { return $this->_em->createQueryBuilder() ->select($alias) ->from($this->_entityName, $alias); //the second parameter lost }
        Hide
        Guilherme Blanco added a comment -

        In r7006 this issue was fixed. Thanks for the clear report now... it saves quite some time =)
        Also thanks for the patch!

        Cheers,

        Show
        Guilherme Blanco added a comment - In r7006 this issue was fixed. Thanks for the clear report now... it saves quite some time =) Also thanks for the patch! Cheers,
        Hide
        Valery Dubrava added a comment -

        Thanks for fix =)

        Show
        Valery Dubrava added a comment - Thanks for fix =)

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Valery Dubrava
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: