95102[TASK] Test QueryResult with objects instead of arrays
Commit message
Review
-
Code review CR +2 Done
- Georg Ringer +2
- Daniel Gohlke +1
- Sebastian Iffland +1
- Josua Vogel +1
-
Verified V +2 Done
- Georg Ringer +2
- Daniel Gohlke +1
- Josua Vogel +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1821
-
Oliver Klee uploaded patch set 1 08/04/26, 10:31
-
Oliver Klee uploaded patch set 2 08/04/26, 10:34
-
core-ci voted on patch set 1 V -1 08/04/26, 10:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105939
-
core-ci voted on patch set 2 V +1 08/04/26, 10:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105940
-
Sebastian Iffland voted on patch set 2 CR +1 08/04/26, 11:13
-
Josua Vogel voted on patch set 2 CR +1 V +1 08/04/26, 12:03
-
Garvin Hicking commented on patch set 2 08/04/26, 12:14
But I think queryResult CAN work with array, so shouldn't we probably cover both scenarios? Otherwise if at some point the array dealing might break we wouldn't notice? -
Oliver Klee commented on patch set 2 08/04/26, 12:30
Reply
This is about the single result items in the query result, not about the set of items. The way I read the source code, `::first` and `::current()` are only intended to return either an object or `false`/`null`, but not an array: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php#L197 Currently, returning arrays also works (at least when we mock things). I think this works "by accident" and not as promised functionality as we currently don't enforce the contract via native type declarations. As soon as we (i.e., I) add native type declarations, those unit tests break. The rest of Core tests all are green. This means that at least in the Core, `QueryResult` will is used to only return objects, not arrays. -
Garvin Hicking commented on patch set 2 08/04/26, 12:47
Reply
Thanks for explaining. I can't verify this right now and don't want to block things, so I'm resolving this! -
Simon Schaufelberger voted on patch set 2 CR +1 V +1 08/04/26, 21:22
-
Georg Ringer voted on patch set 2 CR +1 V +1 08/05/26, 07:55
-
Daniel Gohlke voted on patch set 2 CR +1 08/06/26, 18:28
-
Daniel Gohlke voted on patch set 2 V +1 08/06/26, 19:01
-
Oliver Klee uploaded patch set 3
CR +1V +108/17/26, 08:05 -
core-ci voted on patch set 3 V +1 08/17/26, 08:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106808
-
Georg Ringer voted on patch set 3 CR +1 V +1 08/17/26, 08:14
-
Daniel Gohlke voted on patch set 3 CR +1 V +1 08/17/26, 08:24
-
Josua Vogel voted on patch set 3 CR +1 V +1 08/17/26, 09:14
-
Sebastian Iffland voted on patch set 3 CR +1 08/17/26, 09:30
-
Georg Ringer voted on patch set 3 CR +2 V +2 08/17/26, 10:43
-
Georg Ringer merged patch set 4 08/17/26, 10:43