#60463Wrong condition against Statement in getObjectCountByQuery
Description
Hello Core-Team,
I have created my own statement that way:
return $query->statement($sql, array(..., ...))->execute();
Further I have added a check on count of this result and YES: I know that this could not work :-)
<f:if condition="{projects -> f:count()}">
...
</f:if>
In Typo3DbBackend.php I found these rows in getObjectCountByQuery
if ($query->getConstraint() instanceof Statement) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\BadConstraintException('Could not execute count on queries with a constraint of type TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Statement', 1256661045);
}
But Contraint is NULL of cause. I have created a statement instead as mentioned above. Some lines up in method getObjectDataByQuery you have done it correct:
$statement = $query->getStatement();
if ($statement instanceof Statement) {
In my opinion we/you should copy the correct part of getObjectDataByQuery also to getObjectCountByQuery.
Stefan
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.