Project

General

Profile

Actions

Bug #60463

closed

Wrong condition against Statement in getObjectCountByQuery

Added by Stefan Froemken almost 10 years ago. Updated almost 6 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-07-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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

Actions

Also available in: Atom PDF