---
title: "Deprecation: #97354 - ExpressionBuilder methods andX() and orX()"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:deprecation-97354"
source: "Changelog/12.0/Deprecation-97354-ExpressionBuilderMethodsAndXAndOrX.rst"
typo3-version: "12.0"
typo3-major: 12
type: "deprecation"
issue: 97354
forge: "https://forge.typo3.org/issues/97354"
tags: ["Database", "FullyScanned", "ext:core"]
rendered: "2026-09-20T18:31:11+00:00"
---

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

See [forge#97354](https://forge.typo3.org/issues/97354)

## Description {#description}

`doctrine/dbal` [deprecated](https://github.com/doctrine/dbal/commit/84328cd947706210caebcaea3ca0394b3ebc4673)  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 {#impact}

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

## Affected Installations {#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 {#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:

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

should be replaced with:

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