Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend_Paginator / Doctrine 2

I'm using Doctrine 2 with my Zend Framework application and a typical query result could yield a million (or more) search results.

I want to use Zend_Paginator in line with this result set. However, I don't want to return all the results as an array and use the Array adapter as this would be inefficient, instead I would like to supply the paginator the total amount of rows then and array of results based on limit/offset amounts.

Is this doable using the Array adapter or would I need to create my own pagination adapter?

like image 957
Kevin Avatar asked Dec 10 '25 13:12

Kevin


1 Answers

You will have to extend your own adapter. The Array adapter works the way you don't want - it receives an array and return a portion of it based on the current settings. What you'll need is a new adapter that will take DQL statemenet and set the limit/offset.

like image 76
Tomáš Fejfar Avatar answered Dec 12 '25 03:12

Tomáš Fejfar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!