class EmbeddedDocumentSerializer (View source)

Helper class serializing/unserializing embedded documents.

Methods

__construct($metadataFactory, $metadataResolver)

No description

array
serializeEmbeddedDocument(object $embeddedValue, array $embeddedFieldMapping, $embedMany = false)

Serializes an embedded document value into array given the mapping metadata for the class.

object
createEmbeddedDocument(array $data, object $embeddedFieldMapping)

Create a document for an embedded document field mapping from json data.

doCreateEmbeddedDocument($data, $embeddedFieldMapping)

No description

boolean
isChanged(array $value, object $originalData, array $valueFieldMapping)

Compares the two representation of an embedded document.

Details

__construct($metadataFactory, $metadataResolver)

Parameters

$metadataFactory
$metadataResolver

array serializeEmbeddedDocument(object $embeddedValue, array $embeddedFieldMapping, $embedMany = false)

Serializes an embedded document value into array given the mapping metadata for the class.

Parameters

object $embeddedValue
array $embeddedFieldMapping
$embedMany

Return Value

array

Exceptions

InvalidArgumentException

object createEmbeddedDocument(array $data, object $embeddedFieldMapping)

Create a document for an embedded document field mapping from json data.

Parameters

array $data
object $embeddedFieldMapping

Return Value

object

Exceptions

InvalidArgumentException

doCreateEmbeddedDocument($data, $embeddedFieldMapping)

Parameters

$data
$embeddedFieldMapping

boolean isChanged(array $value, object $originalData, array $valueFieldMapping)

Compares the two representation of an embedded document.

If the original misses doctrine_metadata, but the values are the same, we assume there is no change If the original has doctrine_metadata, and the new value has different class, that's a change, even if the values are the same.

Parameters

array $value
object $originalData
array $valueFieldMapping Mapping of the field that contains the embedded document in the embedder document.

Return Value

boolean