public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
{
if ($source instanceof \DateTimeInterface) {
$dateFormat = $this->getDateFormat($configuration);
return $source->format($dateFormat);
}
if (is_array($source)) {
switch ($this->getArrayFormat($configuration)) {
case self::ARRAY_FORMAT_CSV:
return implode($this->getCsvDelimiter($configuration), $source);
case self::ARRAY_FORMAT_JSON:
return json_encode($source);
default:
throw new InvalidPropertyMappingConfigurationException(sprintf('Invalid array export format "%s" given', $this->getArrayFormat($configuration)), 1404317220);
}
}
return (string) $source;
}