Fr3nch13/CakePHP Utilities

BinaryUuidType extends BaseType
in package

Binary UUID type converter.

Use to convert binary uuid data between PHP and the database types.

Table of Contents

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()  : mixed
Marshals flat data into PHP objects.
newId()  : string
Generate a new binary UUID
toDatabase()  : resource|string|null
Convert binary uuid data into the database format.
toPHP()  : resource|string|null
Convert binary uuid into resource handles
toStatement()  : int
Get the correct PDO binding type for Binary data.
convertBinaryUuidToString()  : string
Converts a binary uuid to a string representation
convertStringToBinaryUuid()  : string
Converts a string UUID (36 or 32 char) to a binary representation.

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 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 binary UUID

public newId() : string
Return values
string

A new primary key value.

toDatabase()

Convert binary uuid data into the database format.

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

Binary data is not altered before being inserted into the database. As PDO will handle reading file handles.

Parameters
$value : mixed

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Return values
resource|string|null

toPHP()

Convert binary uuid into resource handles

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

The value to convert.

$driver : DriverInterface

The driver instance to convert with.

Tags
throws
CakeException
Return values
resource|string|null

toStatement()

Get the correct PDO binding type for Binary data.

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

The value being bound.

$driver : DriverInterface

The driver.

Return values
int

convertBinaryUuidToString()

Converts a binary uuid to a string representation

protected convertBinaryUuidToString(mixed $binary) : string
Parameters
$binary : mixed

The value to convert.

Return values
string

Converted value.

convertStringToBinaryUuid()

Converts a string UUID (36 or 32 char) to a binary representation.

protected convertStringToBinaryUuid(string $string) : string
Parameters
$string : string

The value to convert.

Return values
string

Converted value.


        
On this page

Search results