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()
Note
The replacement methods have already been added in a forward-compatible way in TYPO3 v11. Thus giving extension developers the ability to adopt new methods and still being able to support multiple Core versions without workarounds.
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();
should be replaced with:
$rows = $queryBuilder
->select(...)
->from(...)
->where(
$queryBuilder->expr()->and(...), // replacement for andX(...)
$queryBuilder->expr()->or(...) // replacement for orX(...)
)
->executeQuery()
->fetchAllAssociative();