2006-08-18 02:53:52 +04:00
|
|
|
<?php
|
|
|
|
class Article extends Doctrine_Record {
|
|
|
|
public function setTableDefinition() {
|
|
|
|
$this->hasColumn("title","string", 200);
|
|
|
|
|
|
|
|
// maps to TINYINT on mysql
|
2007-01-28 13:13:54 +03:00
|
|
|
$this->hasColumn("section", "enum", 2, array('values' => array("PHP","Python","Java","Ruby")));
|
2006-08-18 02:53:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$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
|
|
|
|
?>
|