1 | <?php |
||
7 | class Column |
||
8 | { |
||
9 | const TYPE_INTEGER = 'integer'; |
||
10 | const TYPE_DECIMAL = 'decimal'; |
||
11 | const TYPE_STRING = 'string'; |
||
12 | const TYPE_BOOLEAN = 'boolean'; |
||
13 | const TYPE_DATETIME = 'datetime'; |
||
14 | const TYPE_BLOB = 'blob'; |
||
15 | const TYPE_DATE = 'date'; |
||
16 | const TYPE_TIME = 'time'; |
||
17 | const TYPE_FLOAT = 'float'; |
||
18 | const TYPE_BIT = 'bit'; |
||
19 | const TYPE_SPATIAL_GEOMETRY = 'geometry'; |
||
20 | const TYPE_NULL = 'null'; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected static $typesMap = [ |
||
26 | self::TYPE_INTEGER => 'Definition\IntegerColumn', |
||
27 | self::TYPE_DECIMAL => 'Definition\DecimalColumn', |
||
28 | self::TYPE_STRING => 'Definition\StringColumn', |
||
29 | self::TYPE_BOOLEAN => 'Definition\BooleanColumn', |
||
30 | self::TYPE_DATETIME => 'Definition\DatetimeColumn', |
||
31 | self::TYPE_BLOB => 'Definition\BlobColumn', |
||
32 | self::TYPE_DATE => 'Definition\DateColumn', |
||
33 | self::TYPE_TIME => 'Definition\TimeColumn', |
||
34 | self::TYPE_FLOAT => 'Definition\FloatColumn', |
||
35 | self::TYPE_BIT => 'Definition\BitColumn', |
||
36 | self::TYPE_SPATIAL_GEOMETRY => 'Definition\GeometryColumn', |
||
37 | self::TYPE_NULL => 'Definition\NullColumn', |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * Create a data column definition. |
||
42 | * |
||
43 | * @param string $datatype |
||
44 | * @param string $name |
||
45 | * @param string $tableName |
||
46 | * @param string $schemaName |
||
47 | * |
||
48 | * @throws Exception\UnsupportedTypeException |
||
49 | * |
||
50 | * @return Definition\AbstractColumnDefinition |
||
51 | */ |
||
52 | 3 | public static function createColumnDefinition($datatype, $name, $tableName = null, $schemaName = null) |
|
61 | |||
62 | /** |
||
63 | * Return all supported types. |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | 1 | public static function getSupportedTypes() |
|
71 | } |
||
72 |