Fr3nch13/CakePHP Utilities

IntegerType extends BaseType
in package
implements BatchCastingInterface

Integer type converter.

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

Table of Contents

Interfaces

BatchCastingInterface
Denotes type objects capable of converting many values from their original database representation to php values.

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.
manyToPHP()  : array<string, mixed>
Returns an array of the values converted to the PHP representation of this type.
marshal()  : int|null
Marshals request data into PHP integers.
newId()  : mixed
Generate a new primary key value for a given type.
toDatabase()  : int|null
Convert integer data into the database format.
toPHP()  : int|null
Casts given value from a database type to a PHP equivalent.
toStatement()  : int
Get the correct PDO binding type for integer data.
checkNumeric()  : void
Checks if the value is not a numeric value

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.

manyToPHP()

Returns an array of the values converted to the PHP representation of this type.

public manyToPHP(array<string|int, mixed> $values, array<string|int, mixed> $fields, DriverInterface $driver) : array<string, mixed>
Parameters
$values : array<string|int, mixed>

The original array of values containing the fields to be casted

$fields : array<string|int, mixed>

The field keys to cast

$driver : DriverInterface

Object from which database preferences and configuration will be extracted.

Tags
inheritDoc
Return values
array<string, mixed>

marshal()

Marshals request data into PHP integers.

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

The value to convert.

Return values
int|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.

toDatabase()

Convert integer data into the database format.

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

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Return values
int|null

toPHP()

Casts given value from a database type to a PHP equivalent.

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

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Return values
int|null

toStatement()

Get the correct PDO binding type for integer data.

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

The value being bound.

$driver : DriverInterface

The driver.

Return values
int

checkNumeric()

Checks if the value is not a numeric value

protected checkNumeric(mixed $value) : void
Parameters
$value : mixed

Value to check

Tags
throws
InvalidArgumentException

        
On this page

Search results