[TOC]
DBAL类型
下表是dbal类型与mysqll类型的对应表, 其中required和comment属性是所有dbal类型天生具备的.
| doctrine类型 | 默认mysql类型 | length | precision | scale | autoincrement | unsigned | fixed |
|---|---|---|---|---|---|---|---|
| array | text | √ | × | × | × | × | × |
| array_simple | text | × | × | × | × | × | × |
| json_array | text | × | × | × | × | × | × |
| bigint | bigint | × | × | × | √ | √ | × |
| boolean | tinyint(1) | × | × | × | × | × | × |
| datetime | datetime | × | × | × | × | × | × |
| datetimez | datetime | × | × | × | × | × | × |
| date | date | × | × | × | × | × | × |
| time | time | × | × | × | × | × | × |
| decimal | numeric(10,0) | × | √ | √ | × | × | × |
| integer | int | × | × | × | √ | √ | × |
| object | text | × | × | × | × | × | × |
| smallint | smallint | × | × | × | √ | √ | × |
| string | varchar(255) | √ | × | × | × | × | √ |
| text | longtext | × | × | × | × | × | × |
| binary | varbinary(255) | √ | × | × | × | × | √ |
| blob | longblob | × | × | × | × | × | × |
| float | double precision | × | × | × | × | × | × |
| guid | char(36) | × | × | × | × | × | × |
| text | longtext | × | × | × | × | × | × |
内置预定义类型
| buildin type | DBAL type | options |
|---|---|---|
| bool | boolean | |
| money | decimal | ['precision' => 20, 'scale' = 3] |
| string | ||
| time | integer | ['unsigned' => 'true'] |
| region | string | |
| password | string | ['length' => 32] |
| number | integer | ['unsigned' => true] |
| float | float | |
| gender | string | ['length' => 6] |
| ipaddr | string | ['length' => 20] |
| serialize | text | |
| last_modify | integer | ['unsigned' => true] |