public function convert($source, $targetType, PropertyMappingConfigurationInterface $configuration = null)
{
if ($configuration === null) {
$configuration = $this->buildPropertyMappingConfiguration();
}
$currentPropertyPath = [];
$this->messages = new Result();
try {
$result = $this->doMapping($source, $targetType, $configuration, $currentPropertyPath);
if ($result instanceof Error) {
return null;
}
return $result;
} catch (SecurityException $exception) {
throw $exception;
} catch (\Exception $exception) {
throw new PropertyException('Exception while property mapping for target type "' . $targetType . '", at property path "' . implode('.', $currentPropertyPath) . '": ' . $exception->getMessage(), 1297759968, $exception);
}
}