Class UuidType
Provides behavior for the UUID type
Property Summary
- 
        $_name protectedstring|nullIdentifier name for this type 
Method Summary
- 
          __construct() publicConstructor 
- 
          getBaseType() publicReturns the base type name that this class is inheriting. 
- 
          getName() publicReturns type identifier name for this object. 
- 
          marshal() publicMarshals request data into a PHP string 
- 
          newId() publicGenerate a new UUID 
- 
          requiresToPhpCast() publicReturns whether the cast to PHP is required to be invoked, since it is not a identity function. 
- 
          toDatabase() publicCasts given value from a PHP type to one acceptable by database 
- 
          toPHP() publicConvert string values to PHP strings. 
- 
          toStatement() publicGet the correct PDO binding type for string data. 
Method Detail
__construct() ¶ public
__construct(string|null $name = null)Constructor
Parameters
- 
                string|null$name optional
- The name identifying this type 
getBaseType() ¶ public
getBaseType(): string|nullReturns the base type name that this class is inheriting.
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.
Returns
string|nullgetName() ¶ public
getName(): string|nullReturns type identifier name for this object.
Returns
string|nullmarshal() ¶ public
marshal(mixed $value): string|nullMarshals request data into a PHP string
Most useful for converting request data into PHP objects, that make sense for the rest of the ORM/Database layers.
Parameters
- 
                mixed$value
- The value to convert. 
Returns
string|nullConverted value.
newId() ¶ public
newId(): stringGenerate a new UUID
This method can be used by types to create new primary key values when entities are inserted.
Returns
stringA new primary key value.
requiresToPhpCast() ¶ public
requiresToPhpCast(): boolReturns whether the cast to PHP is required to be invoked, since it is not a identity function.
Returns
boolFalse as database results are returned already as strings
toDatabase() ¶ public
toDatabase(mixed $value, Cake\Database\DriverInterface $driver): string|nullCasts given value from a PHP type to one acceptable by database
Parameters
- 
                mixed$value
- value to be converted to database equivalent 
- 
                Cake\Database\DriverInterface$driver
- object from which database preferences and configuration will be extracted 
Returns
string|nulltoPHP() ¶ public
toPHP(mixed $value, Cake\Database\DriverInterface $driver): string|nullConvert string values to PHP strings.
Parameters
- 
                mixed$value
- The value to convert. 
- 
                Cake\Database\DriverInterface$driver
- The driver instance to convert with. 
Returns
string|nulltoStatement() ¶ public
toStatement(mixed $value, Cake\Database\DriverInterface $driver): intGet the correct PDO binding type for string data.
Parameters
- 
                mixed$value
- The value being bound. 
- 
                Cake\Database\DriverInterface$driver
- The driver. 
Returns
int