Getting started - Setting table definition - Data types and lengths.php 753 Bytes
Newer Older
doctrine's avatar
doctrine committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?php
class Article extends Doctrine_Record {
    public function setTableDefinition() {
        // few mapping examples:

        // maps into VARCHAR(100) on mysql
        $this->hasColumn("title","string",100);
        
        // maps into TEXT on mysql
        $this->hasColumn("content","string",4000);

        // maps into TINYINT on mysql
        $this->hasColumn("type","integer",1);

        // maps into INT on mysql
        $this->hasColumn("type2","integer",11);

        // maps into BIGINT on mysql
        $this->hasColumn("type3","integer",20);

        // maps into TEXT on mysql
        // (serialized and unserialized automatically by doctrine)
        $this->hasColumn("types","array",4000);

    }
}
?>