Deprecation: #97354 - ExpressionBuilder methods andX() and orX()
See forge#97354
Description
doctrine/
deprecated the Expression
methods
and
and or
. Therefore, those methods have also been
deprecated in the Core facade class (\TYPO3\
),
to avoid shifting too far away.
Impact
Using Expression
and Expression
will trigger a PHP E_
error when called.
Affected Installations
All installations, using the deprecated methods Expression
and Expression
in custom extension code. The extension
scanner will detect any usage as weak match.
Migration
Extensions should use the corresponding replacement:
Expression
->Builder->and X () Expression
Builder->and () Expression
->Builder->or X () Expression
Builder->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();