Fr3nch13/CakePHP Utilities

StringType extends BaseType
in package
implements OptionalConvertInterface

String type converter.

Use to convert string data between PHP and the database types.

Table of Contents

Interfaces

OptionalConvertInterface
An interface used by Type objects to signal whether the casting is actually required.

Properties

$_name  : string|null
Identifier name for this type

Methods

__construct()  : mixed
Constructor
getBaseType()  : string|null
Returns the base type name that this class is inheriting.
getName()  : string|null
Returns type identifier name for this object.
marshal()  : string|null
Marshals request data into PHP strings.
newId()  : mixed
Generate a new primary key value for a given type.
requiresToPhpCast()  : bool
Returns whether the cast to PHP is required to be invoked, since it is not a identity function.
toDatabase()  : string|null
Convert string data into the database format.
toPHP()  : string|null
Convert string values to PHP strings.
toStatement()  : int
Get the correct PDO binding type for string data.

Properties

$_name

Identifier name for this type

protected string|null $_name

Methods

__construct()

Constructor

public __construct([string|null $name = null ]) : mixed
Parameters
$name : string|null = null

The name identifying this type

getBaseType()

Returns the base type name that this class is inheriting.

public getBaseType() : string|null
Tags
inheritDoc
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
Tags
inheritDoc
Return values
string|null

The type identifier name for this object.

marshal()

Marshals request data into PHP strings.

public marshal(mixed $value) : string|null
Parameters
$value : mixed

The value to convert.

Return values
string|null

Converted value.

newId()

Generate a new primary key value for a given type.

public newId() : mixed
Tags
inheritDoc
Return values
mixed

A new primary key value.

requiresToPhpCast()

Returns whether the cast to PHP is required to be invoked, since it is not a identity function.

public requiresToPhpCast() : bool
Return values
bool

False as database results are returned already as strings

toDatabase()

Convert string data into the database format.

public toDatabase(mixed $value, DriverInterface $driver) : string|null
Parameters
$value : mixed

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Return values
string|null

toPHP()

Convert string values to PHP strings.

public toPHP(mixed $value, DriverInterface $driver) : string|null
Parameters
$value : mixed

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Return values
string|null

toStatement()

Get the correct PDO binding type for string data.

public toStatement(mixed $value, DriverInterface $driver) : int
Parameters
$value : mixed

The value being bound.

$driver : DriverInterface

The driver.

Return values
int

        
On this page

Search results