// set data and payload cursor to root or extensions to simplify following if conditions
$dataCursor =
$data;
$payloadCursor = &
$payload;
if ($field instanceof VersionField ||
$field instanceof ReferenceVersionField
) { continue;
} if ($field->
is(Extension::
class)) { $dataCursor =
$data['extensions'
] ??
[];
$payloadCursor = &
$extensions;
if (isset($dataCursor['foreignKeys'
])) { $fields =
$definition->
getFields();
/**
* @var string $key
* @var string $value
*/
foreach ($dataCursor['foreignKeys'
] as $key =>
$value) { // Clone FK extension and add it to payload
if (\
is_string($value) && Uuid::
isValid($value) &&
$fields->
has($key) &&
$fields->
get($key) instanceof FkField
) {