Project

General

Profile

Actions

Bug #103703

closed

TYPO3 QueryBuilder does not allow all Doctrine DBAL types

Added by Daniel Siepmann 26 days ago. Updated 19 days ago.

Status:
Closed
Priority:
Won't have this time
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2024-04-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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())
));
Actions

Also available in: Atom PDF