1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/docs/Getting started - Setting table definition - Default values.php
legenerationlazi 13840516a9 removed empty php tags at the top of some pages
html->wiki conversion previously missed
2007-04-19 20:41:19 +00:00

23 lines
573 B
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.
<code type="php">
<?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.