PropelORM

<database name="default">
  <table name="book">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
    <column name="title" type="varchar" size="255" required="true" />
    <column name="isbn" type="varchar" size="24" required="true" phpName="ISBN"/>
    <column name="author_id" type="integer" required="true"/>
    <foreign-key foreignTable="author">
      <reference local="author_id" foreign="id"/>
    </foreign-key>
  </table>
  <table name="author">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
    <column name="first_name" type="varchar" size="128" required="true"/>
    <column name="last_name" type="varchar" size="128" required="true"/>
  </table>
</database>
$book = new Book();
$book->setTitle('My Heros');
$book->setIsbn('123154');

$author = new Author();
$author->setFirstName('Hans');
$author->setLastName('Zimmer');

$book->setAuthor($author);
$book->save();

var_dump($book->toArray());

A highly customizeable and blazing fast ORM library for PHP 5.4+

PropelORM →

Related: This PropelORM Cheat Sheet might come in handy, as does this PropelORM Silex Service Provider if you’re using it with Silex.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.