[TOC]

DBAL类型

下表是dbal类型与mysqll类型的对应表, 其中requiredcomment属性是所有dbal类型天生具备的.

doctrine类型默认mysql类型lengthprecisionscaleautoincrementunsignedfixed
arraytext×××××
array_simpletext××××××
json_arraytext××××××
bigintbigint××××
booleantinyint(1)××××××
datetimedatetime××××××
datetimezdatetime××××××
datedate××××××
timetime××××××
decimalnumeric(10,0)××××
integerint××××
objecttext××××××
smallintsmallint××××
stringvarchar(255)××××
textlongtext××××××
binaryvarbinary(255)××××
bloblongblob××××××
floatdouble precision××××××
guidchar(36)××××××
textlongtext××××××

doctrine dbal types文档有详细说明

内置预定义类型

buildin typeDBAL typeoptions
boolboolean
moneydecimal['precision' => 20, 'scale' = 3]
emailstring
timeinteger['unsigned' => 'true']
regionstring
passwordstring['length' => 32]
numberinteger['unsigned' => true]
floatfloat
genderstring['length' => 6]
ipaddrstring['length' => 20]
serializetext
last_modifyinteger['unsigned' => true]