Neos.Neos/Classes/Service/Mapping/NodePropertyConverterService.php
protected function convertValue($propertyValue, $dataType)
    {
        $parsedType = TypeHandling::parseType($dataType);

        // This hardcoded handling is to circumvent rewriting PropertyMappers that convert objects. Usually they expect the source to be an object already and break if not.
        if (!TypeHandling::isSimpleType($parsedType['type']) && !is_object($propertyValue) && !is_array($propertyValue)) {
            return null;
        }

        $conversionTargetType = $parsedType['type'];
        if (!TypeHandling::isSimpleType($parsedType['type'])) {
            $conversionTargetType = 'array';
        }
        // Technically the "string" hardcoded here is irrelevant as the configured type converter wins, but it cannot be the "elementType"
        // because if the source is of the type $elementType then the PropertyMapper skips the type converter.
        if ($parsedType['type'] === 'array' && $parsedType['elementType'] !== null) {
            $conversionTargetType .= '<' . (TypeHandling::isSimpleType($parsedType['elementType']) ? $parsedType['elementType'] : 'string') . '>';
        }

        $propertyMappingConfiguration = $this->createConfiguration($dataType);
        $convertedValue = $this->propertyMapper->convert($propertyValue, $conversionTargetType, $propertyMappingConfiguration);
        if ($convertedValue instanceof \Neos\Error\Messages\Error) {
            throw new PropertyException($convertedValue->getMessage(), $convertedValue->getCode());
        }

        return $convertedValue;
    }
protected function convertValue($propertyValue, $dataType)
    {
        $parsedType = TypeHandling::parseType($dataType);

        // This hardcoded handling is to circumvent rewriting PropertyMappers that convert objects. Usually they expect the source to be an object already and break if not.
        if (!TypeHandling::isSimpleType($parsedType['type']) && !is_object($propertyValue) && !is_array($propertyValue)) {
            return null;
        }

        $conversionTargetType = $parsedType['type'];
        if (!TypeHandling::isSimpleType($parsedType['type'])) {
            $conversionTargetType = 'array';
        }
        // Technically the "string" hardcoded here is irrelevant as the configured type converter wins, but it cannot be the "elementType"
        // because if the source is of the type $elementType then the PropertyMapper skips the type converter.
        if ($parsedType['type'] === 'array' && $parsedType['elementType'] !== null) {
            $conversionTargetType .= '<' . (TypeHandling::isSimpleType($parsedType['elementType']) ? $parsedType['elementType'] : 'string') . '>';
        }

        $propertyMappingConfiguration = $this->createConfiguration($dataType);
        $convertedValue = $this->propertyMapper->convert($propertyValue, $conversionTargetType, $propertyMappingConfiguration);
        if ($convertedValue instanceof \Neos\Error\Messages\Error) {
            throw new PropertyException($convertedValue->getMessage(), $convertedValue->getCode());
        }

        return $convertedValue;
    }
protected function convertValue ( $ propertyValue , $ dataType ) { $ parsedType = TypeHandling :: parseType ( $ dataType ) ; // This hardcoded handling is to circumvent rewriting PropertyMappers that convert objects. Usually they expect the source to be an object already and break if not. if ( ! TypeHandling :: isSimpleType ( $ parsedType [ 'type' ] ) && ! is_object ( $ propertyValue ) && ! is_array ( $ propertyValue ) ) { return null ; } $ conversionTargetType = $ parsedType [ 'type' ] ; if ( ! TypeHandling :: isSimpleType ( $ parsedType [ 'type' ] ) ) { $ conversionTargetType = 'array' ; } // Technically the "string" hardcoded here is irrelevant as the configured type converter wins, but it cannot be the "elementType" // because if the source is of the type $elementType then the PropertyMapper skips the type converter. if ( $ parsedType [ 'type' ] === 'array' && $ parsedType [ 'elementType' ] !== null ) { $ conversionTargetType .= '<' . ( TypeHandling :: isSimpleType ( $ parsedType [ 'elementType' ] ) ? $ parsedType [ 'elementType' ] : 'string' ) . '>' ; } $ propertyMappingConfiguration = $ this -> createConfiguration ( $ dataType ) ; $ convertedValue = $ this -> propertyMapper -> convert ( $ propertyValue , $ conversionTargetType , $ propertyMappingConfiguration ) ; if ( $ convertedValue instanceof \ Neos \ Error \ Messages \ Error ) { throw new PropertyException ( $ convertedValue -> getMessage ( ) , $ convertedValue -> getCode ( ) ) ; } return $ convertedValue ; }
Convert the given value to a simple type or an array of simple types.

@param mixed $propertyValue
@param string $dataType
@return mixed
@throws PropertyException
Convert the given value to a simple type or an array of simple types .