Some years ago, I created a CMS for Digital Signage. Flash Player was the hottest thing an earth. You see, it's really long time ago ;-)
For the CMS, I used Zend Framework 1, its MVC structure, helpers and the database abstraction layer, Zend_Db. I loved the table and rowset pattern.

After the switch from Postleaf to Leafpub I thought of converting the Leafpub "models", which was a mixture of database access with plain SQL and helper functions, to an ORM.
Cory did a great job with planning the database and the model functionality. 
But it's my personal preference to keep database access and other helper functions divided from each other. 
I also wanted to support more database systems with Leafpub. So Leafpub must use an ORM.

I tried Laravel's Eloquent first, but it doesn't makes me happy. It's a cool piece of code, but... no, it's not my thing.
Then I found Slim PDO. I also tried and played a little bit, but it also wasnt't my big thing. So I decided to use Zend Db.

With Zend Db, Leafpub supports now MS SQL, Oracle, MySQL, SQLite and PostgreSQL.
We also removed the standard database script and make use of Zend's CreateTable classes.

Our models extend the abstract model class 'AbstractModel' which also implements a Interface called ModelInterface. The Interface defines 5 methods (getMany, getOne, create, edit and delete).
With Zend Db, you dont't need to write 1 line of SQL. You only use class methods. As example you'll see 2 screenshots from the Backup::jsonToDb method. This method writes a backup to the database.


Left image: database insert before Zend Db. Right image: After implementation of Zend Db.

I hope, you'll enjoy the new database abstraction layer.

You'll find Leafpub 1.1.0-beta4 at Github.