[TYPO3-mvc] QueryResult question

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jan 19 12:53:54 CET 2011


Hey Henjo,

> I get the error:
>
> "Argument 1 passed to
> Tx_Fluid_ViewHelpers_Widget_PaginateViewHelper::render() must implement
> interface Tx_Extbase_Persistence_QueryResultInterface, array given".
>
> I tried altering my query by extending the execute() with ->getQuery()
> and also toArray() but without succes.
> Below my findAll function:
>
> /*
> * $param integer $limit
> *
> */
> public function findAll(){
>
> $orderings = array('date' =>
> Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING);
> $query = $this->createQuery();
> $post = $query->setOrderings($orderings)
> ->execute()->toArray();
> return $post;
> }
>
> What am I missing here?

$query->execute() will by default return a queryResult object which is 
needed by the widget - so don't use ->toArray() etc and make sure to 
pass the queryResult object to the view and the widget - that's it.
You can use the queryResult object directly in your template, use it in 
the for-viewHelper etc - so no need to convert it to a array anywhere in 
your code.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list