[TYPO3-mvc] Problems with widget.paginate ViewHelper

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Sep 8 16:44:35 CEST 2011


Hi,

> I always get this error:
> "PHP Catchable Fatal Error: Argument 1 passed to
> Tx_Fluid_ViewHelpers_Widget_PaginateViewHelper::render() must implement
> interface Tx_Extbase_Persistence_QueryResultInterface, instance of
> Tx_Extbase_Persistence_LazyObjectStorage given in
> /var/www/typo3_src-4.5.3/typo3/sysext/fluid/Classes/ViewHelpers/Widget/PaginateViewHelper.php
> line 76"
>
> The action looks like this:
> public function galleryAction(Tx_Myextension_Domain_Model_Collection
> $collection) {
> $this->view->assign('collection', $collection);
> }
...
> what exactly should be assigned to the view?

the paginate widget needs a QueryResult object, usually returned by your 
repository.

$records = $this->myRepository->findByFoo($foo);
$this->view->assign('records', $records);

<f:widget.paginate objects="{records}"...


It doesn't work with arrays or objectStorages yet, so if you need that 
feature, you would have to write your own, extended version of the 
paginate widget that can also deal arrays and objectStorages. Or add a 
feature/pull request and hope to get that feature in for the upcoming 
Fluid 1.4.
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list