#109572Extbase Repository Query cannot query for is null
Description
How can I test for “NOT Null” in an Extbase Repository, where the field is a nullable date? neither one seems to do the trick:
$constraints[] = $query->greaterThan('myDate', 0);
// or
$constraints[] = $query->logicalNot($query->equals('myDate', null))
The only way to test this is to use the dbal query builder…
Following TCA snippet was used to reproduce the error:
'fromdatetime' => [
'exclude' => true,
'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_termin.fromdatetime',
'config' => [
'type' => 'datetime',
'default' => 0,
],
],
Then we created entries over TYPO3 backend tca form and get a 0 value in db instead of e.g. null or valid datetime obj.
In Extbase Model we used:
protected ?\DateTime $fromdatetime = null;
The problem is, the check on null is never true, because we have a default set to 0.
Reviews 1
History 58
-
Lina Wolf changed description <span data-processor="relativetime" data-value="2026-04-14T07:54:04+00:00" > 04/14/26, 07:54 </span>
-
Benni Mack changed Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2026-08-06T16:02:54+00:00" > 08/06/26, 16:02 </span>
-
Eike Drost changed assigned to Eike Drost <span data-processor="relativetime" data-value="2026-08-07T06:21:24+00:00" > 08/07/26, 06:21 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 95162 status
NewUnder Review <span data-processor="relativetime" data-value="2026-08-07T06:48:17+00:00" > 08/07/26, 06:48 </span> -
Eike Drost changed description <span data-processor="relativetime" data-value="2026-08-07T12:54:27+00:00" > 08/07/26, 12:54 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 95162 <span data-processor="relativetime" data-value="2026-08-07T13:20:52+00:00" > 08/07/26, 13:20 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 95162 <span data-processor="relativetime" data-value="2026-10-16T15:32:56+00:00" > 10/16/26, 15:32 </span>
i work on that.