protected function flattenValue($identifier, $object, $propertyName, array $propertyMetaData, array &$propertyData)
{
$propertyValue = ObjectAccess::getProperty($object, $propertyName, true);
if ($propertyValue instanceof PersistenceMagicInterface) {
$propertyData[$propertyName] = ['type' => get_class($propertyValue), 'multivalue' => false, 'value' => $this->processObject($propertyValue, $identifier)];
} else {
switch ($propertyMetaData['type']) {
case 'DateTime':
$propertyData[$propertyName] = ['multivalue' => false, 'value' => $this->processDateTime($propertyValue)];
break;
case Collection::class:
case ArrayCollection::class:
$propertyValue = $propertyValue === null ? [] : $propertyValue->toArray();
case 'array':
$propertyData[$propertyName] = ['multivalue' => true, 'value' => $this->processArray($propertyValue, $identifier, $this->persistenceSession->getCleanStateOfProperty($object, $propertyName))];
break;
case 'SplObjectStorage':
$propertyData[$propertyName] = ['multivalue' => true, 'value' => $this->processSplObjectStorage($propertyValue, $identifier, $this->persistenceSession->getCleanStateOfProperty($object, $propertyName))];
break;
default:
if ($propertyValue === null && !TypeHandling::isSimpleType($propertyMetaData['type'])) {
$this->removeDeletedReference($object, $propertyName, $propertyMetaData);
}
$propertyData[$propertyName] = ['multivalue' => false, 'value' => $propertyValue];
break;
}
$propertyData[$propertyName]['type'] = $propertyMetaData['type'];
}
}