PHP Class Mongolid\Serializer\Serializer

It's a bug present in 1.1 version and should be fixed in version 1.2, so, this class can be deleted after upgrade our dependency of 1.1 version of MongoDB driver
See also: https://jira.mongodb.org/browse/PHPC-460
Mostrar archivo Open project: leroy-merlin-br/mongolid Class Usage Examples

Protected Properties

Property Type Description
$converter Mongolid\Serializer\Type\Converter

Public Methods

Method Description
__construct ( Converter $converter ) Constructor.
convert ( array $attributes ) : array Converts recursively the given objects (probably retrieved from MongoDB) to our specific types.
serialize ( array $attributes ) : string Walk into an array to get not serializable objects and replace it by a serializable one.
unconvert ( array $attributes ) : array Unconverts recursively the given objects to persistable objects on MongoDB Example: converts Type\ObjectID to MongoDB\BSON\ObjectID.
unserialize ( string $data ) : array Unserializes the given string and turn it back to specific objects.

Method Details

__construct() public method

Constructor.
public __construct ( Converter $converter )
$converter Mongolid\Serializer\Type\Converter Class responsible to convert objects.

convert() public method

Example: converts MongoDB\BSON\ObjectID to Type\ObjectID.
public convert ( array $attributes ) : array
$attributes array Array to convert.
return array

serialize() public method

Walk into an array to get not serializable objects and replace it by a serializable one.
public serialize ( array $attributes ) : string
$attributes array ActiveRecord attributes to be serialized.
return string

unconvert() public method

Unconverts recursively the given objects to persistable objects on MongoDB Example: converts Type\ObjectID to MongoDB\BSON\ObjectID.
public unconvert ( array $attributes ) : array
$attributes array Array to convert.
return array

unserialize() public method

Unserializes the given string and turn it back to specific objects.
public unserialize ( string $data ) : array
$data string Serialized string to be converted.
return array

Property Details

$converter protected_oe property

protected Converter,Mongolid\Serializer\Type $converter
return Mongolid\Serializer\Type\Converter