1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| class Machine extends DBObject {
var $accounts=NULL;
var $instances=NULL;
// static
function &getTable() {
$table =& new DBTable('machine');
$table->add(new DBColumn('num',DBColumn__TYPE_NUM),TRUE);
$table->add(new DBColumn('name',DBColumn__TYPE_CHAR));
$table->add(new DBColumn('description',DBColumn__TYPE_CHAR));
$table->add(new DBColumn('isactive',DBColumn__TYPE_NUM));
$table->setKeyBehavior(DBTable__KEYBEHAVIOR_AUTOINCREMENT);
$table->addIndex(array('name')); return $table;
}
// constructor
function Machine($key) {
$this->DBObject($key);
if($this->isNew()) {
$this->set('isactive',Machine__ACTIVE_YES);
}
} |
Partager