[TYPO3-mvc] QueryResult object has issues with offsets and "count" method ?

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Nov 19 04:12:33 CET 2010


Hey there,

I didn't dig deeper into this as it's a little late and I want to go to 
bed now, but I just noticed a issue with the QueryResult object in 
combination with it's count method. In combination with a defined offset 
by the repository, count will return NULL/FALSE. After the QueryResult 
object got initialized by triggering any other function, it's returning 
the correct count. Anybody else having this issue?


My scenario:
- CONTROLLER ----------
$exhibitors = $this->exhibitorRepository->findDemanded($demand, $offset, 
$limit);
$this->view->assign('exhibitors', $exhibitors);

- VIEW ----------------
<f:if condition="{f:count(subject:exhibitors)}">
	<f:then># some output</f:then>
	<f:else>No exhibitors found</f:else>0
</f:if>
-----------------------

Result: "No exhibitors found"


So the count is returning FALSE/NULL. By adding the following to my 
controller, I get this debug output:

$exhibitors = $this->exhibitorRepository...
t3lib_div::debug($exhibitors->count()); #(a
$exhibitors->valid();
t3lib_div::debug($exhibitors->count()); #(b
------
a) nothing
b) "50" (which is correct)


So there seems to be a issue with the method "getObjectCountByQuery" 
which is used by the queryResult object if it hasn't been initialized 
before.

Did I do anything wrong (besides not using the new pagination widget, 
but I don't want to adopt all my existing extensions and templates)? The 
query itself is correct, because after initialization the list is 
rendered correctly.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list