1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/codes/Getting started - Setting table definition - Constraints and validators.php

16 lines
522 B
PHP
Raw Normal View History

2006-08-31 02:45:13 +04:00
<?php
class User extends Doctrine_Record {
public function setTableDefinition() {
// the name cannot contain whitespace
$this->hasColumn("name", "string", 50, array("nospace" => true));
2006-08-31 02:45:13 +04:00
// the email should be a valid email
$this->hasColumn("email", "string", 200, array("email" => true));
// home_country should be a valid country code and not null
$this->hasColumn("home_country", "string", 2, array("country" => true, "notnull" => true));
2006-08-31 02:45:13 +04:00
}
}
?>