Object relational mapping - Columns - Data types - Enum.php 712 Bytes
Newer Older
hansbrix's avatar
hansbrix committed
1 2
Doctrine has a unified enum type. Enum typed columns automatically convert the string values into index numbers and vice versa. The possible values for the column
can be specified with Doctrine_Record::setEnumValues(columnName, array values).
3

hansbrix's avatar
hansbrix committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<code type="php">
class Test extends Doctrine_Record {
    public function setTableDefinition() {
        $this->hasColumn('enumtest', 'enum', 4, 
                         array(
                            'values' => array(
                                        'php',
                                        'java',
                                        'python'
                                        )
                               )
			 );
    }
}
</code>