Column
class Column (View source)
Class for a table column.
Constants
STRING |
|
INTEGER |
|
DECIMAL |
|
DATETIME |
|
DATE |
|
TIME |
|
Properties
static array | $TYPE_MAPPING | Map a type to an column type. | |
string | $name | The true name of this column. | |
string | $inflected_name | The inflected name of this columns . | |
integer | $type | The type of this column: STRING, INTEGER, . | |
string | $raw_type | The raw database specific type. | |
int | $length | The maximum length of this column. | |
boolean | $nullable | True if this column allows null. | |
boolean | $pk | True if this column is a primary key. | |
mixed | $default | The default value of the column. | |
boolean | $auto_increment | True if this column is set to auto_increment. | |
boolean | $sequence | Name of the sequence to use for this column if any. |
Methods
static int|string
castIntegerSafely(mixed $value)
Cast a value to an integer type safely
mixed
mixed
map_raw_type()
Sets the $type member variable.
Details
at line 122
static int|string
castIntegerSafely(mixed $value)
Cast a value to an integer type safely
This will attempt to cast a value to an integer, unless its detected that the casting will cause the number to overflow or lose precision, in which case the number will be returned as a string, so that large integers (BIGINTS, unsigned INTS, etc) can still be stored without error
This would ideally be done with bcmath or gmp, but requiring a new PHP extension for a bug-fix is a little ridiculous
at line 153
mixed
cast(mixed $value, Connection $connection)
Casts a value to the column's type.
at line 189
mixed
map_raw_type()
Sets the $type member variable.