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'];
        }
    }
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'];
        }
    }
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' ] ; } }
Convert a value to the internal object data format

@param string $identifier The object's identifier
@param object $object The object with the property to flatten
@param string $propertyName The name of the property
@param array $propertyMetaData The property metadata
@param array $propertyData Reference to the property data array
@return void
@api
Convert a value to the internal object data format