Neos\Flow\Property\PropertyMappingConfiguration::setTypeConverter PHP Метод

setTypeConverter() публичный Метод

Set a type converter which should be used for this specific conversion.
public setTypeConverter ( Neos\Flow\Property\TypeConverterInterface $typeConverter ) : PropertyMappingConfiguration
$typeConverter Neos\Flow\Property\TypeConverterInterface
Результат PropertyMappingConfiguration this
    public function setTypeConverter(TypeConverterInterface $typeConverter)
    {
        $this->typeConverter = $typeConverter;
        return $this;
    }

Usage Example

 /**
  * Parses the request body according to the media type.
  *
  * @param HttpRequest $httpRequest
  * @return array
  */
 protected function parseRequestBody(HttpRequest $httpRequest)
 {
     $requestBody = $httpRequest->getContent();
     if ($requestBody === null || $requestBody === '') {
         return [];
     }
     $mediaTypeConverter = $this->objectManager->get(MediaTypeConverterInterface::class);
     $propertyMappingConfiguration = new PropertyMappingConfiguration();
     $propertyMappingConfiguration->setTypeConverter($mediaTypeConverter);
     $propertyMappingConfiguration->setTypeConverterOption(MediaTypeConverterInterface::class, MediaTypeConverterInterface::CONFIGURATION_MEDIA_TYPE, $httpRequest->getHeader('Content-Type'));
     $arguments = $this->propertyMapper->convert($requestBody, 'array', $propertyMappingConfiguration);
     return $arguments;
 }
All Usage Examples Of Neos\Flow\Property\PropertyMappingConfiguration::setTypeConverter