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
Afficher le fichier Open project: leroy-merlin-br/mongolid Class Usage Examples

Protected Properties

Свойство Type Description
$converter Mongolid\Serializer\Type\Converter

Méthodes publiques

Méthode 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 méthode

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

convert() public méthode

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

serialize() public méthode

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.
Résultat string

unconvert() public méthode

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.
Résultat array

unserialize() public méthode

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

Property Details

$converter protected_oe property

protected Converter,Mongolid\Serializer\Type $converter
Résultat Mongolid\Serializer\Type\Converter