TypeInterface
in
Encapsulates all conversion functions for values coming from a database into PHP and going from PHP into a database.
Table of Contents
Methods
- getBaseType() : string|null
- Returns the base type name that this class is inheriting.
- getName() : string|null
- Returns type identifier name for this object.
- marshal() : mixed
- Marshals flat data into PHP objects.
- newId() : mixed
- Generate a new primary key value for a given type.
- toDatabase() : mixed
- Casts given value from a PHP type to one acceptable by a database.
- toPHP() : mixed
- Casts given value from a database type to a PHP equivalent.
- toStatement() : mixed
- Casts given value to its Statement equivalent.
Methods
getBaseType()
Returns the base type name that this class is inheriting.
public
getBaseType() : string|null
This is useful when extending base type for adding extra functionality, but still want the rest of the framework to use the same assumptions it would do about the base type it inherits from.
Return values
string|null —The base type name that this class is inheriting.
getName()
Returns type identifier name for this object.
public
getName() : string|null
Return values
string|null —The type identifier name for this object.
marshal()
Marshals flat data into PHP objects.
public
marshal(mixed $value) : mixed
Most useful for converting request data into PHP objects, that make sense for the rest of the ORM/Database layers.
Parameters
- $value : mixed
-
The value to convert.
Return values
mixed —Converted value.
newId()
Generate a new primary key value for a given type.
public
newId() : mixed
This method can be used by types to create new primary key values when entities are inserted.
Tags
Return values
mixed —A new primary key value.
toDatabase()
Casts given value from a PHP type to one acceptable by a database.
public
toDatabase(mixed $value, DriverInterface $driver) : mixed
Parameters
- $value : mixed
-
Value to be converted to a database equivalent.
- $driver : DriverInterface
-
Object from which database preferences and configuration will be extracted.
Return values
mixed —Given PHP type casted to one acceptable by a database.
toPHP()
Casts given value from a database type to a PHP equivalent.
public
toPHP(mixed $value, DriverInterface $driver) : mixed
Parameters
- $value : mixed
-
Value to be converted to PHP equivalent
- $driver : DriverInterface
-
Object from which database preferences and configuration will be extracted
Return values
mixed —Given value casted from a database to a PHP equivalent.
toStatement()
Casts given value to its Statement equivalent.
public
toStatement(mixed $value, DriverInterface $driver) : mixed
Parameters
- $value : mixed
-
Value to be converted to PDO statement.
- $driver : DriverInterface
-
Object from which database preferences and configuration will be extracted.
Return values
mixed —Given value casted to its Statement equivalent.