Getting started - Setting table definition - Constraints and validators.php 469 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php
class User extends Doctrine_Record {
    public function setTableDefinition() {
        // the name cannot contain whitespace
        $this->hasColumn("name", "string", 50, "nospace");
        
        // the email should be a valid email
        $this->hasColumn("email", "string", 200, "email");
        
        // home_country should be a valid country code
        $this->hasColumn("home_country", "string", 2, "country");
        
    }
}
?>