Mapping your entity classes to your database has never been that easy.
Initialize a connection, declare the mapper in your entity class and you're ready to operate:
namespace My\Model; class Book extends Entity { /** * @field incremented * @primary */ public $id; /** * @field * @type integer */ protected $title; /** * @field * @type string */ protected $author; /** ... getters, setters and business part */ }
<?php index.php use My\Model\Book; $book = new Book(); $book->setTitle("The Grapes of Wrath"); $book->setAuthor("John Steinbeck"); $book->save(); $last = Book::findOne("select * from Book order by `date_creation` desc limit 1); if ($last->getTitle() == $book->getTitle()) { echo "It worked!"; }