<ac:macro ac:name="note"><ac:parameter ac:name="title">Under Construction</ac:parameter><ac:rich-text-body>
<p>This proposal is being merged with <a class="external-link" href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Paginate+-+Jurri">http://framework.zend.com/wiki/display/ZFPROP/Zend_Paginate+-+Jurri</a>ën+Stutterheim+and+Matthew+Ratzloff</p></ac:rich-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
Zend_Paginator is a pagination class for both database- and view-level pagination. Users supply a page number and an optional configuration object and the rest is handled more or less seamlessly. The database strategy is the default, but view-level pagination can be selected in the options. For database pagination, users should have their models implement Zend_Paginator_Pageable_Interface.
Disclaimer: This is something I threw together over a couple of hours on Christmas Eve. I haven't coded anything yet, so I'm not sure if everything would work exactly as currently described. I really should probably finish all my other proposals and not-yet-proposals before I create another proposal, but this is something that a lot of people probably need right away. I really wasn't impressed with any other pagination implementations I came across. In general, they were just too limiting.Zend Framework: Zend_Paginator - Matthew Ratzloff Component Proposal
Proposed Component Name
Zend_Paginator - Matthew Ratzloff
Developer Notes
http://framework.zend.com/wiki/display/ZFDEV/Zend_Paginator - Matthew Ratzloff
Proposers
Matthew Ratzloff
Darby Felton, Zend liaison
Revision
0.1 - First version (wiki revision: 8)
Table of Contents
1. Overview
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
4. Dependencies on Other Framework Components
- Zend_Exception
- Zend_Db
- Probably not Zend_View (but we'll see)
5. Theory of Operation
6. Milestones / Tasks
- Milestone 1: Proposal is finished.
- Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
- Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
- Milestone 4: Unit tests exist, work, and are checked into SVN.
- Milestone 5: Initial documentation exists.
7. Class Index
- Zend_Paginator
- Zend_Paginator_Exception
- Zend_Paginator_Page
- Zend_Paginator_Pageable_Interface
- Zend_Paginator_Strategy_Db
- Zend_Paginator_Strategy_View
8. Use Cases
| UC-01 |
|---|
Database-level pagination example
Controller:
Model (which implements Zend_Paginator_Pageable_Interface):
View (page_selector.php partial):
| UC-02 |
|---|
View-level pagination example
Controller:
View (page_selector.php partial):
9. Class Skeletons
Here's a partial list. This includes the public methods.
2 Comments
comments.show.hideDec 24, 2007
Matthew Ratzloff
<p>Two comments to get any design discussion rolling:</p>
<p>1. I'd like the DB strategy to return a statement and the view strategy to return some sort of array-like object (like a Rowset). I'd like them to have the same name, but that might be unfeasible... so I may have to end up stretching the concept of the Strategy pattern and just pass through variously-named strategy methods with __call().</p>
<p>2. I don't like the fact that the Paginator object is implicitly modified by the view (and I especially don't like the fact that a change takes place to the object when calling a get*() method--see above for a possible solution).</p>
Mar 17, 2008
Jurrien Stutterheim
<p>For the Zym project (www.zym-project.com) I wrote a pagination component myself.<br />
It exists of an abstract class and three concrete classes (for arrays, Iterator instances and Db_Table instances).<br />
I didn't use a separate Page class for Zym_Paginate, because I didn't see any added value over an array/(Limit)Iterator or Row_Set. Please have a look at Zym_Paginate and let me know what you think.</p>
<p>As for the idea of a pagination component in general: it's got my vote <ac:emoticon ac:name="smile" /></p>