if ($versionName !== null && !
ctype_alnum($versionName)) { throw ApiException::
invalidVersionName();
} try { $entityDefinition =
$this->definitionRegistry->
getByEntityName($entity);
} catch (DefinitionNotFoundException
$e) { throw ApiException::
definitionNotFound($e);
} $versionId =
$context->
scope(Context::CRUD_API_SCOPE,
fn (Context
$context): string =>
$this->definitionRegistry->
getRepository($entityDefinition->
getEntityName())->
createVersion($id,
$context,
$versionName,
$versionId));
return new JsonResponse([ 'versionId' =>
$versionId,
'versionName' =>
$versionName,
'id' =>
$id,
'entity' =>
$entity,
]);
} #[Route(path: '/api/_action/version/merge/{entity}/{versionId}', name: 'api.mergeVersion', methods: ['POST'], requirements: ['version' => '\d+', 'entity' => '[a-zA-Z-]+', 'versionId' => '[0-9a-f]{32}'])]
public function mergeVersion(Context
$context, string
$entity, string
$versionId): JsonResponse
{