\QuickApps\Database\TypeSerializedType

Serialized type converter.

Serialize data, if needed. Arrays and object are automatically serialized to be stored in DB.

Summary

Methods
Properties
Constants
toPHP()
toDatabase()
No public properties found
No constants found
_isSerialized()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toPHP()

toPHP(string $value, \Cake\Database\Driver $driver) : mixed

Deserialize the stored information if it was serialized before.

Parameters

string $value

The serialized element to deserialize

\Cake\Database\Driver $driver

Database connection driver

Returns

mixed

toDatabase()

toDatabase(mixed $value, \Cake\Database\Driver $driver) : string

Serializes (if it can) the information to be stored in DB.

Arrays and object are serialized, any other type of information will be stored as plain text.

Parameters

mixed $value

Array or object to be serialized, any other type will not be serialized

\Cake\Database\Driver $driver

Database connection driver

Returns

string

_isSerialized()

_isSerialized(mixed $data) : boolean

Check value to find if it was serialized.

If $data is not an string, then returned value will always be false. Serialized data is always a string.

Parameters

mixed $data

Value to check to see if was serialized

Returns

boolean —

False if not serialized and true if it was