Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeImportService.php
protected function convertElementToValue(\XMLReader $reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty)
    {
        switch ($currentType) {
            case 'object':
                if ($currentClassName === 'DateTime') {
                    $stringValue = trim($reader->value);
                    $value = $this->propertyMapper->convert($stringValue, $currentClassName, $this->propertyMappingConfiguration);
                    if ($this->propertyMapper->getMessages()->hasErrors()) {
                        throw new ImportException(sprintf('Could not convert element <%s> to DateTime for node %s', $currentProperty, $currentNodeIdentifier), 1472992032);
                    }
                } elseif ($currentEncoding === 'json') {
                    $decodedJson = json_decode($reader->value, true);
                    if (json_last_error() !== JSON_ERROR_NONE) {
                        throw new ImportException(sprintf('Could not parse encoded JSON in element <%s> for node %s: %s', $currentProperty, $currentNodeIdentifier, json_last_error_msg()), 1472992033);
                    }
                    $value = $this->propertyMapper->convert($decodedJson, $currentClassName, $this->propertyMappingConfiguration);
                    if ($this->propertyMapper->getMessages()->hasErrors()) {
                        throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentClassName, $currentNodeIdentifier), 1472992034);
                    }
                } else {
                    throw new ImportException(sprintf('Unsupported encoding "%s"', $currentEncoding), 1404397061);
                }
                break;
            case 'string':
                $value = $reader->value;
                break;
            default:
                $value = $this->propertyMapper->convert($reader->value, $currentType, $this->propertyMappingConfiguration);
                if ($this->propertyMapper->getMessages()->hasErrors()) {
                    throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentType, $currentNodeIdentifier), 1472992035);
                }
                return $value;
        }

        $this->persistEntities($value);
        return $value;
    }
protected function convertElementToValue(\XMLReader $reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty)
    {
        switch ($currentType) {
            case 'object':
                if ($currentClassName === 'DateTime') {
                    $stringValue = trim($reader->value);
                    $value = $this->propertyMapper->convert($stringValue, $currentClassName, $this->propertyMappingConfiguration);
                    if ($this->propertyMapper->getMessages()->hasErrors()) {
                        throw new ImportException(sprintf('Could not convert element <%s> to DateTime for node %s', $currentProperty, $currentNodeIdentifier), 1472992032);
                    }
                } elseif ($currentEncoding === 'json') {
                    $decodedJson = json_decode($reader->value, true);
                    if (json_last_error() !== JSON_ERROR_NONE) {
                        throw new ImportException(sprintf('Could not parse encoded JSON in element <%s> for node %s: %s', $currentProperty, $currentNodeIdentifier, json_last_error_msg()), 1472992033);
                    }
                    $value = $this->propertyMapper->convert($decodedJson, $currentClassName, $this->propertyMappingConfiguration);
                    if ($this->propertyMapper->getMessages()->hasErrors()) {
                        throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentClassName, $currentNodeIdentifier), 1472992034);
                    }
                } else {
                    throw new ImportException(sprintf('Unsupported encoding "%s"', $currentEncoding), 1404397061);
                }
                break;
            case 'string':
                $value = $reader->value;
                break;
            default:
                $value = $this->propertyMapper->convert($reader->value, $currentType, $this->propertyMappingConfiguration);
                if ($this->propertyMapper->getMessages()->hasErrors()) {
                    throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentType, $currentNodeIdentifier), 1472992035);
                }
                return $value;
        }

        $this->persistEntities($value);
        return $value;
    }
protected function convertElementToValue ( \ XMLReader $ reader , $ currentType , $ currentEncoding , $ currentClassName , $ currentNodeIdentifier , $ currentProperty ) { switch ( $ currentType ) { case 'object' : if ( $ currentClassName === 'DateTime' ) { $ stringValue = trim ( $ reader -> value ) ; $ value = $ this -> propertyMapper -> convert ( $ stringValue , $ currentClassName , $ this -> propertyMappingConfiguration ) ; if ( $ this -> propertyMapper -> getMessages ( ) -> hasErrors ( ) ) { throw new ImportException ( sprintf ( 'Could not convert element <%s> to DateTime for node %s' , $ currentProperty , $ currentNodeIdentifier ) , 1472992032 ) ; } } elseif ( $ currentEncoding === 'json' ) { $ decodedJson = json_decode ( $ reader -> value , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new ImportException ( sprintf ( 'Could not parse encoded JSON in element <%s> for node %s: %s' , $ currentProperty , $ currentNodeIdentifier , json_last_error_msg ( ) ) , 1472992033 ) ; } $ value = $ this -> propertyMapper -> convert ( $ decodedJson , $ currentClassName , $ this -> propertyMappingConfiguration ) ; if ( $ this -> propertyMapper -> getMessages ( ) -> hasErrors ( ) ) { throw new ImportException ( sprintf ( 'Could not convert element <%s> to %s for node %s' , $ currentProperty , $ currentClassName , $ currentNodeIdentifier ) , 1472992034 ) ; } } else { throw new ImportException ( sprintf ( 'Unsupported encoding "%s"' , $ currentEncoding ) , 1404397061 ) ; } break ; case 'string' : $ value = $ reader -> value ; break ; default : $ value = $ this -> propertyMapper -> convert ( $ reader -> value , $ currentType , $ this -> propertyMappingConfiguration ) ; if ( $ this -> propertyMapper -> getMessages ( ) -> hasErrors ( ) ) { throw new ImportException ( sprintf ( 'Could not convert element <%s> to %s for node %s' , $ currentProperty , $ currentType , $ currentNodeIdentifier ) , 1472992035 ) ; } return $ value ; } $ this -> persistEntities ( $ value ) ; return $ value ; }
Convert an element to the value it represents.

@param \XMLReader $reader
@param string $currentType current element (userland) type
@param string $currentEncoding date encoding of element
@param string $currentClassName class name of element
@param string $currentNodeIdentifier identifier of the node
@param string $currentProperty current property name
@return mixed
@throws ImportException
Convert an element to the value it represents .