Propel ORM
What?
Propel is an Object-Relational Mapping (ORM) framework for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.
Why?
Propel allows you, the web application developer, to work with databases in the same way you work with other classes and objects in PHP.
- Propel gives your database a well-defined API.
- Propel uses the PHP5 OO standards -- Exceptions, autoloading, Iterators and friends.
Propel makes database coding fun again.
Show Me!
$book = BookPeer::retrieveByPK(123); //retrieve a record from a database
$book->setName('Don\'t be Hax0red!'); //modify. Don't worry about escaping
$book->save(); //save
$criteria = new Criteria(); //retrieve all...
$criteria->add(BookPeer::PUBLISH_YEAR, 2009); //... books published 2009
$criteria->addAscendingOrderBy(AuthorPeer::LAST_NAME); //... ordered by author
foreach(BookPeer::doSelectJoinAuthor($criteria) as $book) {
echo $book->getAuthor()->getFullName();
}
