Type
in package
The base class for so-called Doctrine mapping types.
Tags
Table of Contents
- BIGINT = 'bigint'
- BINARY = 'binary'
- BLOB = 'blob'
- BOOLEAN = 'boolean'
- DATE = 'date'
- DATETIME = 'datetime'
- DATETIMETZ = 'datetimetz'
- DECIMAL = 'decimal'
- FLOAT = 'float'
- GUID = 'guid'
- INTEGER = 'integer'
- JSON_ARRAY = 'json_array'
- OBJECT = 'object'
- SIMPLE_ARRAY = 'simple_array'
- SMALLINT = 'smallint'
- STRING = 'string'
- TARRAY = 'array'
- TEXT = 'text'
- TIME = 'time'
- $_typeObjects : array<string|int, mixed>
- Map of already instantiated type objects. One instance per type (flyweight).
- $_typesMap : array<string|int, mixed>
- The map of supported doctrine mapping types.
- __toString() : string
- addType() : void
- Adds a custom type to the type map.
- canRequireSQLConversion() : bool
- Does working with this column require SQL conversion functions?
- convertToDatabaseValue() : mixed
- Converts a value from its PHP representation to its database representation of this type.
- convertToDatabaseValueSQL() : string
- Modifies the SQL expression (identifier, parameter) to convert to a database value.
- convertToPHPValue() : mixed
- Converts a value from its database representation to its PHP representation of this type.
- convertToPHPValueSQL() : string
- Modifies the SQL expression (identifier, parameter) to convert to a PHP value.
- getBindingType() : int
- Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.
- getDefaultLength() : int|null
- Gets the default length of this type.
- getMappedDatabaseTypes() : array<string|int, mixed>
- Gets an array of database types that map to this Doctrine type.
- getName() : string
- Gets the name of this type.
- getSQLDeclaration() : string
- Gets the SQL declaration snippet for a field of this type.
- getType() : Type
- Factory method to create type instances.
- getTypesMap() : array<string|int, mixed>
- Gets the types array map which holds all registered types and the corresponding type class
- hasType() : bool
- Checks if exists support for a type.
- overrideType() : void
- Overrides an already defined type to use a different implementation.
- requiresSQLCommentHint() : bool
- If this Doctrine Type maps to an already mapped database type, reverse schema engineering can't take them apart. You need to mark one of those types as commented, which will have Doctrine use an SQL comment to typehint the actual Doctrine Type.
- __construct() : mixed
- Prevents instantiation and forces use of the factory method.
Constants
BIGINT
public
mixed
BIGINT
= 'bigint'
BINARY
public
mixed
BINARY
= 'binary'
BLOB
public
mixed
BLOB
= 'blob'
BOOLEAN
public
mixed
BOOLEAN
= 'boolean'
DATE
public
mixed
DATE
= 'date'
DATETIME
public
mixed
DATETIME
= 'datetime'
DATETIMETZ
public
mixed
DATETIMETZ
= 'datetimetz'
DECIMAL
public
mixed
DECIMAL
= 'decimal'
FLOAT
public
mixed
FLOAT
= 'float'
GUID
public
mixed
GUID
= 'guid'
INTEGER
public
mixed
INTEGER
= 'integer'
JSON_ARRAY
public
mixed
JSON_ARRAY
= 'json_array'
OBJECT
public
mixed
OBJECT
= 'object'
SIMPLE_ARRAY
public
mixed
SIMPLE_ARRAY
= 'simple_array'
SMALLINT
public
mixed
SMALLINT
= 'smallint'
STRING
public
mixed
STRING
= 'string'
TARRAY
public
mixed
TARRAY
= 'array'
TEXT
public
mixed
TEXT
= 'text'
TIME
public
mixed
TIME
= 'time'
Properties
$_typeObjects
Map of already instantiated type objects. One instance per type (flyweight).
private
static array<string|int, mixed>
$_typeObjects
= array()
$_typesMap
The map of supported doctrine mapping types.
private
static array<string|int, mixed>
$_typesMap
= array(self::TARRAY => 'Doctrine\DBAL\Types\ArrayType', self::SIMPLE_ARRAY => 'Doctrine\DBAL\Types\SimpleArrayType', self::JSON_ARRAY => 'Doctrine\DBAL\Types\JsonArrayType', self::OBJECT => 'Doctrine\DBAL\Types\ObjectType', self::BOOLEAN => 'Doctrine\DBAL\Types\BooleanType', self::INTEGER => 'Doctrine\DBAL\Types\IntegerType', self::SMALLINT => 'Doctrine\DBAL\Types\SmallIntType', self::BIGINT => 'Doctrine\DBAL\Types\BigIntType', self::STRING => 'Doctrine\DBAL\Types\StringType', self::TEXT => 'Doctrine\DBAL\Types\TextType', self::DATETIME => 'Doctrine\DBAL\Types\DateTimeType', self::DATETIMETZ => 'Doctrine\DBAL\Types\DateTimeTzType', self::DATE => 'Doctrine\DBAL\Types\DateType', self::TIME => 'Doctrine\DBAL\Types\TimeType', self::DECIMAL => 'Doctrine\DBAL\Types\DecimalType', self::FLOAT => 'Doctrine\DBAL\Types\FloatType', self::BINARY => 'Doctrine\DBAL\Types\BinaryType', self::BLOB => 'Doctrine\DBAL\Types\BlobType', self::GUID => 'Doctrine\DBAL\Types\GuidType')
Methods
__toString()
public
__toString() : string
Return values
string —addType()
Adds a custom type to the type map.
public
static addType(string $name, string $className) : void
Parameters
- $name : string
-
The name of the type. This should correspond to what getName() returns.
- $className : string
-
The class name of the custom type.
Tags
Return values
void —canRequireSQLConversion()
Does working with this column require SQL conversion functions?
public
canRequireSQLConversion() : bool
This is a metadata function that is required for example in the ORM. Usage of and works for any type and mostly does nothing. This method can additionally be used for optimization purposes.
Return values
bool —convertToDatabaseValue()
Converts a value from its PHP representation to its database representation of this type.
public
convertToDatabaseValue(mixed $value, AbstractPlatform $platform) : mixed
Parameters
- $value : mixed
-
The value to convert.
- $platform : AbstractPlatform
-
The currently used database platform.
Return values
mixed —The database representation of the value.
convertToDatabaseValueSQL()
Modifies the SQL expression (identifier, parameter) to convert to a database value.
public
convertToDatabaseValueSQL(string $sqlExpr, AbstractPlatform $platform) : string
Parameters
- $sqlExpr : string
- $platform : AbstractPlatform
Return values
string —convertToPHPValue()
Converts a value from its database representation to its PHP representation of this type.
public
convertToPHPValue(mixed $value, AbstractPlatform $platform) : mixed
Parameters
- $value : mixed
-
The value to convert.
- $platform : AbstractPlatform
-
The currently used database platform.
Return values
mixed —The PHP representation of the value.
convertToPHPValueSQL()
Modifies the SQL expression (identifier, parameter) to convert to a PHP value.
public
convertToPHPValueSQL(string $sqlExpr, AbstractPlatform $platform) : string
Parameters
- $sqlExpr : string
- $platform : AbstractPlatform
Return values
string —getBindingType()
Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.
public
getBindingType() : int
This method should return one of the PDO::PARAM_* constants, that is, one of:
PDO::PARAM_BOOL PDO::PARAM_NULL PDO::PARAM_INT PDO::PARAM_STR PDO::PARAM_LOB
Return values
int —getDefaultLength()
Gets the default length of this type.
public
getDefaultLength(AbstractPlatform $platform) : int|null
Parameters
- $platform : AbstractPlatform
Tags
Return values
int|null —getMappedDatabaseTypes()
Gets an array of database types that map to this Doctrine type.
public
getMappedDatabaseTypes(AbstractPlatform $platform) : array<string|int, mixed>
Parameters
- $platform : AbstractPlatform
Return values
array<string|int, mixed> —getName()
Gets the name of this type.
public
abstract getName() : string
Tags
Return values
string —getSQLDeclaration()
Gets the SQL declaration snippet for a field of this type.
public
abstract getSQLDeclaration(array<string|int, mixed> $fieldDeclaration, AbstractPlatform $platform) : string
Parameters
- $fieldDeclaration : array<string|int, mixed>
-
The field declaration.
- $platform : AbstractPlatform
-
The currently used database platform.
Return values
string —getType()
Factory method to create type instances.
public
static getType(string $name) : Type
Type instances are implemented as flyweights.
Parameters
- $name : string
-
The name of the type (as returned by getName()).
Tags
Return values
Type —getTypesMap()
Gets the types array map which holds all registered types and the corresponding type class
public
static getTypesMap() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasType()
Checks if exists support for a type.
public
static hasType(string $name) : bool
Parameters
- $name : string
-
The name of the type.
Return values
bool —TRUE if type is supported; FALSE otherwise.
overrideType()
Overrides an already defined type to use a different implementation.
public
static overrideType(string $name, string $className) : void
Parameters
- $name : string
- $className : string
Tags
Return values
void —requiresSQLCommentHint()
If this Doctrine Type maps to an already mapped database type, reverse schema engineering can't take them apart. You need to mark one of those types as commented, which will have Doctrine use an SQL comment to typehint the actual Doctrine Type.
public
requiresSQLCommentHint(AbstractPlatform $platform) : bool
Parameters
- $platform : AbstractPlatform
Return values
bool —__construct()
Prevents instantiation and forces use of the factory method.
private
final __construct() : mixed