views:

274

answers:

2

Before I start to build this myself I thought I'd ask others to share their experience. What's the best / your favorite way to paginate a dataset with an application built upon Zend_Framework and Doctrine as your ORM?

I'm new to Doctrine.

I'm calling the model directly from a View Helper, bypassing the Controller, although I'm still interested if your solution uses controllers.

I did see one article on this topic: http://ciaranmcnulty.com/blog/2009/06/Simplify-pagination-logic-using-a-custom-zend-paginator-adapter

Devzone has an article using Doctrine, Zend Framework OR Pear, but none of those options mention a #ZF app that uses Doctrine.

A: 

In theory, one way is to create a custom data source adapter and plug it into Zend Paginator. http://framework.zend.com/manual/en/zend.paginator.advanced.html

pwarnock
+1  A: 

You don't need anything special.

Look on Github for ready paginator adapter, e.g. this one.

takeshin
Thanks. Actually @juokaz sent me the link through twitter, and I got it working from within a controller. I'd love another approach through a view helper but this will do the trick if no one has a solution for view helper.
joedevon
Why can't you move it to the view helper? Just have the model return a Zend_Paginator instance. If you don't know how to fetch the current page when you are not inside of the controller try with Zend_Controller_Front::getInstance()->getRequest()->getParam('page', 1)
Goran Jurić