Doctrine


Doctrine\DBAL\Types\Type
/Doctrine/DBAL/Types/Type.php at line 35

Class Type

Type

public abstract class Type

The base class for so-called Doctrine mapping types.

A Type object is obtained by calling the static getType() method.

Author:
Roman Borschel
Since:
2.0

Field Summary
final str

BIGINT

final str

BOOLEAN

final str

DATE

final str

DATETIME

final str

DECIMAL

final str

INTEGER

final str

OBJECT

final str

SMALLINT

final str

STRING

final str

TARRAY

final str

TEXT

final str

TIME

Constructor Summary

Type()

Method Summary
static void

addType(string name, string className)

Adds a custom type to the type map.

mixed

convertToDatabaseValue(mixed value, AbstractPlatform platform)

Converts a value from its PHP representation to its database representation of this type.

mixed

convertToPHPValue(mixed value, AbstractPlatform platform)

Converts a value from its database representation to its PHP representation of this type.

integer

getBindingType()

Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.

void

getDefaultLength(mixed platform)

Gets the default length of this type.

abstract string

getName()

Gets the name of this type.

abstract void

getSqlDeclaration(array fieldDeclaration, AbstractPlatform platform)

Gets the SQL declaration snippet for a field of this type.

static Doctrine\DBAL\Types\Type

getType(string name)

Factory method to create type instances.

static array

getTypesMap()

Get the types array map which holds all registered types and the corresponding type class

static boolean

hasType(string name)

Checks if exists support for a type.

static void

overrideType(string name, string className)

Overrides an already defined type to use a different implementation.

Field Detail

/Doctrine/DBAL/Types/Type.php at line 38

BIGINT

public final str BIGINT = 'bigint'

/Doctrine/DBAL/Types/Type.php at line 39

BOOLEAN

public final str BOOLEAN = 'boolean'

/Doctrine/DBAL/Types/Type.php at line 41

DATE

public final str DATE = 'date'

/Doctrine/DBAL/Types/Type.php at line 40

DATETIME

public final str DATETIME = 'datetime'

/Doctrine/DBAL/Types/Type.php at line 43

DECIMAL

public final str DECIMAL = 'decimal'

/Doctrine/DBAL/Types/Type.php at line 44

INTEGER

public final str INTEGER = 'integer'

/Doctrine/DBAL/Types/Type.php at line 45

OBJECT

public final str OBJECT = 'object'

/Doctrine/DBAL/Types/Type.php at line 46

SMALLINT

public final str SMALLINT = 'smallint'

/Doctrine/DBAL/Types/Type.php at line 47

STRING

public final str STRING = 'string'

/Doctrine/DBAL/Types/Type.php at line 37

TARRAY

public final str TARRAY = 'array'

/Doctrine/DBAL/Types/Type.php at line 48

TEXT

public final str TEXT = 'text'

/Doctrine/DBAL/Types/Type.php at line 42

TIME

public final str TIME = 'time'

Constructor Detail

/Doctrine/DBAL/Types/Type.php at line 70

Type

public Type()

Method Detail

/Doctrine/DBAL/Types/Type.php at line 153

addType

public static void addType(string name, string className)

Adds a custom type to the type map.

Parameters:
name - Name of the type. This should correspond to what getName() returns.
className - The class name of the custom type.
Throws:
DBALException

/Doctrine/DBAL/Types/Type.php at line 80

convertToDatabaseValue

public mixed convertToDatabaseValue(mixed value, AbstractPlatform platform)

Converts a value from its PHP representation to its database representation of this type.

Parameters:
value - The value to convert.
platform - The currently used database platform.
Returns:
The database representation of the value.

/Doctrine/DBAL/Types/Type.php at line 93

convertToPHPValue

public mixed convertToPHPValue(mixed value, AbstractPlatform platform)

Converts a value from its database representation to its PHP representation of this type.

Parameters:
value - The value to convert.
platform - The currently used database platform.
Returns:
The PHP representation of the value.

/Doctrine/DBAL/Types/Type.php at line 205

getBindingType

public integer getBindingType()

Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.

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


/Doctrine/DBAL/Types/Type.php at line 103

getDefaultLength

public void getDefaultLength(mixed platform)

Gets the default length of this type.

Todo:
Needed?

/Doctrine/DBAL/Types/Type.php at line 122

getName

public abstract string getName()

Gets the name of this type.

Todo:
Needed?

/Doctrine/DBAL/Types/Type.php at line 114

getSqlDeclaration

public abstract void getSqlDeclaration(array fieldDeclaration, AbstractPlatform platform)

Gets the SQL declaration snippet for a field of this type.

Parameters:
fieldDeclaration - The field declaration.
platform - The currently used database platform.

/Doctrine/DBAL/Types/Type.php at line 133

getType

public static Doctrine\DBAL\Types\Type getType(string name)

Factory method to create type instances. Type instances are implemented as flyweights.

Throws:
DBALException
Parameters:
name - The name of the type (as returned by getName()).

/Doctrine/DBAL/Types/Type.php at line 216

getTypesMap

public static array getTypesMap()

Get the types array map which holds all registered types and the corresponding type class

Returns:
$typesMap

/Doctrine/DBAL/Types/Type.php at line 169

hasType

public static boolean hasType(string name)

Checks if exists support for a type.

Parameters:
name - Name of the type
Returns:
TRUE if type is supported; FALSE otherwise

/Doctrine/DBAL/Types/Type.php at line 182

overrideType

public static void overrideType(string name, string className)

Overrides an already defined type to use a different implementation.

Throws:
DBALException

Doctrine