Object-Relational Mapping
Overview
- Built on top of Zend_Db_Table
- supports multiple Storange Engines
How is it used?
class Books extends Kwf_Model_Db { protected $_table = 'books'; } $model = Kwf_Model_Abstract::getInstance('Books'); $book = $model->getRow(123); //get by primary key $book->name = 'Don\'t be Hax0red!'; // modify. Don't worry about escaping $book->save(); // persist the modification to the database $book = $model->createRow(); //create a new row $book = 'Lorem Ipsum Dolor'; $book->save(); $s = new Kwf_Model_Select(); $s->whereEquals('publish_year', 2011); $s->order('title'); foreach ($model->getRows($s) as $book) { echo $book->title; }