News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Till Klampaeckel's Blog:
Iterating over a table (with Zend_Db_Table and Zend_Paginator)
October 12, 2011 @ 11:01:44

Till Klampaeckel has a new post today looking at a solution for a common need - paginating through results as pulled from a database. With the help of the Zend_Db_Table and Zend_Paginator components of the Zend Framework it's a simple matter of passing the results into the Paginator and asking for a certain page.

So frequently, I need to run small data migrations or transformations. Especially on the way to Doctrine, there's a lot to clean-up in a database which has been used and evolved over five years or so.

Code snippets are included to define a class for the table, extending Zend_Db_Table_Abstract, and a new Zend_Paginator_Adapter_DbTableSelect object to create the paginated results. After that, it's as simple as setting the number of items per page and asking for a certain page. There's even a quick bit about being able to edit the rows inside the paginator directly (they're just Zend_Db_Table_Row records).

0 comments voice your opinion now!
tutorial iterate table zendframework zenddbtable zendpaginator


blog comments powered by Disqus

Similar Posts

PseudoCoder.com: How To Really Use Xdebug To Speed Up Your App

ServerGrove Blog: Logging MongoDB queries using Symfony 2 and Doctrine ODM

Zend: Apigility Progress report: zf-mvc-auth, packagist, and PHP's built-in web server

Nick Halstead's Blog: Zend Framework and fav.or.it

Stoyan Stefanov's Blog: phpBB front-end optimization - 1 hour workshop


Community Events

Don't see your event here?
Let us know!


composer conference interview community example install series opinion laravel application podcast api release php7 framework configure symfony2 library introduction performance

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework