Bug #60463

Wrong condition against Statement in getObjectCountByQuery

Added by Stefan Froemken almost 7 years ago. Updated almost 3 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

#1

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31721

#2

Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31721

#3

Updated by Gerrit Code Review over 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31721

#4

Updated by Mathias Schreiber over 5 years ago

  • Target version deleted (next-patchlevel)
#5

Updated by Anja Leichsenring almost 3 years ago

  • Status changed from Under Review to Rejected

Also available in: Atom PDF