protected function convertChangeData($changeData)
{
$type = $changeData['type'];
if (!isset($this->typeMap[$type])) {
return new \TYPO3\Flow\Error\Error(sprintf('Could not convert change type %s, it is unknown to the system', $type));
}
$changeClass = $this->typeMap[$type];
$changeClassInstance = $this->objectManager->get($changeClass);
$subjectContextPath = $changeData['subject'];
$subject = $this->nodeService->getNodeFromContextPath($subjectContextPath);
if ($subject instanceof \TYPO3\Flow\Error\Error) {
return $subject;
}
$changeClassInstance->setSubject($subject);
if (isset($changeData['reference']) && method_exists($changeClassInstance, 'setReference')) {
$referenceContextPath = $changeData['reference'];
$reference = $this->nodeService->getNodeFromContextPath($referenceContextPath);
if ($reference instanceof \TYPO3\Flow\Error\Error) {
return $reference;
}
$changeClassInstance->setReference($reference);
}
if (isset($changeData['payload'])) {
foreach ($changeData['payload'] as $key => $value) {
if (!in_array($key, $this->disallowedPayloadProperties)) {
ObjectAccess::setProperty($changeClassInstance, $key, $value);
}
}
}
return $changeClassInstance;
}