1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/docs/Getting started - Setting table definition - Default values.php

20 lines
627 B
PHP
Raw Normal View History

2006-12-04 02:40:12 +03:00
<?php ?>
Doctrine supports default values for all data types. When default value is attached to a record column this means two of things.
First this value is attached to every newly created Record.
<br \><br \>
<?php
renderCode("<?php
2007-01-07 21:04:17 +03:00
<?php
class User extends Doctrine_record {
2006-12-04 02:40:12 +03:00
public function setTableDefinition() {
2007-01-07 21:04:17 +03:00
\$this->hasColumn('name', 'string', 50, array('default' => 'default name'));
}
2006-12-04 02:40:12 +03:00
}
\$user = new User();
print \$user->name; // default name
?>");
?>
<br \>
Also when exporting record class to database DEFAULT <i>value</i> is attached to column definition statement. <br \>