Search code examples
phpzend-frameworkzend-paginator

Zend_Paginator Without DbSelect/DbTableSelect adapter


Is there a way to use Zend_Paginator Without DbSelect/DbTableSelect adapter without having to fetch whole data set?

I have 2000 objects I want to paginate with Zend_Paginator but I cannot use DbSelect/DbTableSelect for a certain reason.

Is there a way to to this? I could use array for example but that would load all 2000 objects at every page.


Solution

  • I think that the bast way to achieve that is writing your own adapter which will implement Zend_Paginator_Interface (which implements Countable). Then you can hide all your logic behind that adapter and use Zend_Paginator as always.

    Couple paragraphs about custom sources: Zend_Paginator advanced usage.