For a walkthrough of how it works and what you can do with it, read on.
Zend Framework 2 is getting close to release, and among the changes are new ways to handle dependency injection, and new ways to work with third-party code as modules. Rob “Akrabat” Allen has updated his iconic Getting Started with Zend Framework tutorial for ZF2, and it’s a great place to start.
After working through that tutorial, the next thing I wanted to do was figure out how to get the Doctrine 2 ORM up and running.
This article shows how to set up and use Doctrine 2 in Zend Framework 2, by extending Rob’s Getting Started tutorial to use Doctrine instead of Zend_Db.
See the complete source code for this tutorial on Github.
Updated 20 September 2014: Brought up to date with current versions of the ZF tutorial and updated Doctrine composer package name.
Updated 18 June 2012: Added support for new Doctrine config file format.
Updated 2 June 2012: Added support for ZF2 beta 4 and the new composer-based installation methods.
Zend_Paginator is a Zend Framework component for paginating collections of data–for example, breaking a list of blog posts or search results into multiple pages. The easiest way to use Zend_Paginator is by passing it a Zend_Db_Select object, which lets it automagically modify the select query to fetch only the results for the desired page.
But designing your models to work with Zend_Paginator in this way can be messy and inelegant. It often involves either creating a Zend_Paginator instance inside your model or data mapper, or else passing a select object back out of your data mapper. Either approach seems clunky, and violates the encapsulation of your models.
A cleaner approach is to fetch a collection of your models in a custom collection class, and then pass that collection directly to Zend_Paginator. You can write your collection class in such a way that it only fetches data as needed, handling large result sets just as efficiently as passing a select object directly to Zend_Paginator.
Read on to see how. Continue reading
The staff at ProZ.com use the private social networking tool Yammer to post internal status updates. It’s an easy way to stay in the loop and know what everyone else in the company is up to.
I wrote a PHP script that posts to our Developers group on Yammer every time someone commits to our Subversion repository, to help keep on top of changes in the codebase.