---
title: "Breaking: #102875 - ExpressionBuilder changes"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:breaking-102875-1706013339"
source: "Changelog/13.0/Breaking-102875-ExpressionBuilderChanges.rst"
typo3-version: "13.0"
typo3-major: 13
type: "breaking"
issue: 102875
forge: "https://forge.typo3.org/issues/102875"
tags: ["Database", "PHP-API", "NotScanned", "ext:core"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Breaking: #102875 - ExpressionBuilder changes {#breaking-102875-1706013339}

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

## Description {#description}

### Signature changes for following methods {#signature-changes-for-following-methods}

-   `ExpressionBuilder::literal(string $value)`: Value must be a string now.
-   `ExpressionBuilder::trim()`: Only `\Doctrine\DBAL\Platforms\TrimMode`
    enum for `$position` argument.

### Following class constants have been removed {#following-class-constants-have-been-removed}

-   `QUOTE_NOTHING`: Not used since already TYPO3 v12 and Doctrine DBAL 3.x.
-   `QUOTE_IDENTIFIER`: Not used since already TYPO3 v12 and Doctrine DBAL 3.x.
-   `QUOTE_PARAMETER`: Not used since already TYPO3 v12 and Doctrine DBAL 3.x.

## Impact {#impact}

Calling any of the mentioned methods with invalid type will result in a PHP
error.

## Affected installations {#affected-installations}

Only those installations that uses one of the mentioned methods with invalid type(s).

## Migration {#migration}

### `ExpressionBuilder::literal()` {#php-expressionbuilder-literal}

Extension author need to ensure that a string is passed to `literal()`.

### `ExpressionBuilder::trim()` {#php-expressionbuilder-trim}

Extension author need to pass the Doctrine DBAL enum `TrimMode` instead of
an integer.

TRIM_LEADING

| integer | enum |
| --- | --- |
| 0 | TrimMode::UNSPECIFIED |
| 1 | TrimMode::LEADING |
| 2 | TrimMode::TRAILING |
| 3 | TrimMode::BOTH |

**EXT:my_extension/Classes/Domain/Repository/MyTableRepository.php**

```php
use Doctrine\DBAL\Platforms\TrimMode;
use TYPO3\CMS\Core\Database\Connection
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;

// before
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content');
$queryBuilder->expr()->comparison(
    $queryBuilder->expr()->trim($fieldName, 1),
    ExpressionBuilder::EQ,
    $queryBuilder->createNamedParameter('', Connection::PARAM_STR)
);

// after
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content');
$queryBuilder->expr()->comparison(
    $queryBuilder->expr()->trim($fieldName, TrimMode::LEADING),
    ExpressionBuilder::EQ,
    $queryBuilder->createNamedParameter('', Connection::PARAM_STR)
);

// example for dual version compatible code
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content');
$queryBuilder->expr()->comparison(
    $queryBuilder->expr()->trim($fieldName, TrimMode::LEADING),
    ExpressionBuilder::EQ,
    $queryBuilder->createNamedParameter('', Connection::PARAM_STR)
);
```

> [!TIP]
> With Doctrine DBAL 3.x the `TrimMode` was a class with class constants. Using
> these no code changes are needed for TYPO3 v12 and v13 compatible code. Only
> method call type hinting needs to be adjusted to use the enum instead of
> int.
