Review main Merged

92004[BUGFIX] Relax `QueryObjectModelFactory::statement()`

Stefan Bürk CR +2 V +2 Easy +3 −5 updated 12/05/25, 11:21

Commit message

It's a lived practice to pass QueryBuilder instances to the
extbase `Query->statement()` within extbase repositories to
allow execution of custom queries.

Internally this is passed to the internal factory class
`\TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory`
also allowing the three types for the statement which uses
`GeneralUtility::makeInstance()` to create a instance of
`\TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement`.

`Query->statement()` and `Statement::__construct()` allows
passing following types as statement:

* string as $statement
* \TYPO3\CMS\Core\Database\Query\QueryBuilder as $statement
* \Doctrine\DBAL\Statement as $statement

In the past passing a QueryBuilder instance through the chain
worked, albeit `QueryObjectModelFactory::statement()` had only
`string` stated as PHP-Docblock and have been replaced with
native type `string` in #106416 breaking the chain now silently
converting the QueryBuilder to a string and pasing it down.

Looking not that much of an issue, this leads to a different code
path execution in `Typo3DbBackend::getObjectDataByQuery()` and in
some cases to different results as the different results.

This change adopts the additional types in the method signature of
`QueryObjectModelFactory::statement()` to mitigate converting to
string and changing the behaviour. A confusing todo comment in
`Typo3DbBackend->getObjectDataByQuery()` is also removed because
`Qom\Statement->getStatement()` only returning itself a Qom\Statement
does not make much sense or need to have the QueryBuilder conversion
moved to it first.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Torben Hansen +1
    • Sebastian Fischer +1
  • Verified V +2 Done
    • Benni Mack +2
    • core-ci +1 CI

Issues 2

Files 2

Review log 56

  1. Stefan Bürk uploaded patch set 1 12/05/25, 08:24

  2. Sebastian Fischer voted on patch set 1 CR +1 12/05/25, 08:31

  3. core-ci voted on patch set 1 V +1 12/05/25, 08:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91641

  4. Torben Hansen voted on patch set 1 CR +1 12/05/25, 09:02

  5. Benni Mack voted on patch set 1 CR +2 V +2 12/05/25, 11:21

  6. Benni Mack merged patch set 2 12/05/25, 11:21