Issue Bug Closed

#103703TYPO3 QueryBuilder does not allow all Doctrine DBAL types

Daniel Siepmann 04/23/24, 05:47 updated 04/30/24, 08:38

Description

TYPO3 decorates the doctrine dbal QueryBuilder. This includes the createNamedParameter() method.
Doctrine DBAL supports the following types in v12.4: int|string|Type|null while TYPO3 only supports int.
-TYPO3 main (13.x) supports ParameterType|ArrayParameterType while newest dbal 4.x supports string|ParameterType|Type|ArrayParameterType.-

This leads to a situation that it seems impossible to provide a DateTimeImmutable instance and allow dbal to properly cast it to date which could be provided as string in v12 or DateType in main.
That comes in handy if using the native date/datetime/time fields introduced some time ago with TCA.

Is there a reason this is not supported by TYPO3?

Our example code with patched v12.4:

use TYPO3\CMS\Core\Database\Schema\Types\DateType;

$queryBuilder->where($queryBuilder->expr()->gte(
    'date.start',
    $queryBuilder->createNamedParameter($startAfter, new DateType())
));

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.