Deprecation: #97354 - ExpressionBuilder methods andX() and orX()

See forge#97354

Description

doctrine/dbal deprecated the ExpressionBuilder methods andX() and orX. Therefore, those methods have also been deprecated in the Core facade class (\TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder ), to avoid shifting too far away.

Impact

Using ExpressionBuilder->andX() and ExpressionBuilder->orX() will trigger a PHP E_USER_DEPRECATED error when called.

Affected Installations

All installations, using the deprecated methods ExpressionBuilder->andX() and ExpressionBuilder->orX() in custom extension code. The extension scanner will detect any usage as weak match.

Migration

Extensions should use the corresponding replacement:

  • ExpressionBuilder->andX() -> ExpressionBuilder->and()
  • ExpressionBuilder->orX() -> ExpressionBuilder->or()

For example, the following select query:

$rows = $queryBuilder
    ->select(...)
    ->from(...)
    ->where(
        $queryBuilder->expr()->andX(...),   // replace with and(...)
        $queryBuilder->expr()->orX(...)     // replace with or(...)
    )
    ->executeQuery()
    ->fetchAllAssociative();
Copied!

should be replaced with:

$rows = $queryBuilder
    ->select(...)
    ->from(...)
    ->where(
        $queryBuilder->expr()->and(...), // replacement for andX(...)
        $queryBuilder->expr()->or(...)   // replacement for orX(...)
    )
    ->executeQuery()
    ->fetchAllAssociative();
Copied!