Feature: #79262 - Add possibility to create TRIM expression with Doctrine DBAL

See forge#79262

Description

The possibility to create TRIM expressions using Doctrine DBAL has been integrated. However, when using this in comparisons, ExpressionBuilder::comparison() has to be invoked explicitly - otherwise the created TRIM expression would be quoted if e.g. used with ExpressionBuilder::eq().

$queryBuilder->expr()->comparison(
    $queryBuilder->expr()->trim($fieldName),
    ExpressionBuilder::EQ,
    $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)
);
Copied!

The call to $queryBuilder->expr()-trim() can be one of the following:

  • trim('fieldName') results in TRIM("tableName"."fieldName")
  • trim('fieldName', AbstractPlatform::TRIM_LEADING, 'x') results in TRIM(LEADING "x" FROM "tableName"."fieldName")
  • trim('fieldName', AbstractPlatform::TRIM_TRAILING, 'x') results in TRIM(TRAILING "x" FROM "tableName"."fieldName")
  • trim('fieldName', AbstractPlatform::TRIM_BOTH, 'x') results in TRIM(BOTH "x" FROM "tableName"."fieldName")