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)
);
The call to $queryBuilder->expr()-trim()
can be one of the following:
trim('fieldName')
results inTRIM("tableName"."fieldName")
trim('fieldName', AbstractPlatform::TRIM_LEADING, 'x')
results inTRIM(LEADING "x" FROM "tableName"."fieldName")
trim('fieldName', AbstractPlatform::TRIM_TRAILING, 'x')
results inTRIM(TRAILING "x" FROM "tableName"."fieldName")
trim('fieldName', AbstractPlatform::TRIM_BOTH, 'x')
results inTRIM(BOTH "x" FROM "tableName"."fieldName")