Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2668

DQL TRIM function is not converted into TRIM SQL correctly

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.1, 2.3.4
    • Fix Version/s: 2.5, 2.4.1
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      Hi!

      Using DQL to generate SQL TRIM code won't trim '0'.
      For ex., this expression doesn't work:

      $queryBuilder->andWhere("TRIM (LEADING '0' FROM t.field) LIKE :field")
      

      This is happening as whenever TRIM DQL is converted into SQL, trimming character is checked for being 'false' multiple times. In php, both 0 and '0' are equaled to false.

      doctrine/orm/lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php:61
      doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:640

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Slavik Derevyanko
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: