[TYPO3-mvc] QueryResult question
Henjo Hoeksma
me at henjohoeksma.nl
Wed Jan 19 13:13:58 CET 2011
Hi Franz,
On 2011-01-19 12:53:54 +0100, Franz Koch said:
> 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.
That's what I had default... but it generated the same error. I did
some more diggin and found the issues came due to some code in my
controller where I was checking the arguments to do some additional
stuff... Fixed it there!
Thanks for your response!
Henjo
More information about the TYPO3-project-typo3v4mvc
mailing list