13Sep/060
Doctrine ORM and Symfony
I've recently started to follow (and slightly help with development) of Doctrine. It's a fantastic alternative to propel, significantly faster and a lot lighter. I strongly advise you check it out. Documentation is a bit poor, but I'm always on the #doctrine IRC channel on freenode as is the lead developer zYne- and a few others - feel free to pop in and say hello!
Here's a real brief sample of the code stolen from the manual, just to give you a taster
<?php
class Article extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("title","string", 200);
// maps to TINYINT on mysql
$this->hasColumn("section", "enum", 2);
$this->setEnumValues("section", array("PHP","Python","Java","Ruby"));
}
}
$article = new Article;
$article->title = 'My first php article';
// doctrine auto-converts the section to integer when the
// record is being saved
$article->section = 'PHP';
$article->save();
// on insert query with values 'My first php article' and 0
// would be issued
?>
Doctrine can be used with Symfony too, which is great news for me as I'm a huge fan of Symfony. Details on the sfDoctrine plugin can be found here