/**
* Converts a accordingly formatted, associative array to a change collection
*
* @param array $source
* @param string $targetType not used
* @param array $subProperties not used
* @param \TYPO3\Flow\Property\PropertyMappingConfigurationInterface $configuration not used
* @return mixed An object or \TYPO3\Flow\Error\Error if the input format is not supported or could not be converted for other reasons
* @throws \Exception
*/
public function convertFrom($source, $targetType, array $subProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
{
if (!is_array($source)) {
return new \TYPO3\Flow\Error\Error(sprintf('Cannot convert %s to ChangeCollection.', gettype($source)));
}
$changeCollection = new ChangeCollection();
foreach ($source as $changeData) {
$convertedData = $this->convertChangeData($changeData);
if ($convertedData instanceof \TYPO3\Flow\Error\Error) {
return $convertedData;
}
$changeCollection->add($convertedData);
}
return $changeCollection;
}