1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/docs/en/basic-schema-mapping/columns/default-values.txt

15 lines
553 B
Plaintext
Raw Normal View History

2007-09-19 23:39:59 +04:00
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.
<code type="php">
class User extends Doctrine_record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 50, array('default' => 'default name'));
}
}
$user = new User();
print $user->name; // default name
</code>
Also when exporting record class to database DEFAULT //value// is attached to column definition statement.