KMP PHP API Reference

WorkflowVersionManagerInterface

Contract for managing workflow version lifecycle.

Handles draft creation, publishing, archiving, instance migration, and version comparison for workflow definitions.

Table of Contents

Methods

archive()  : ServiceResult
Archive a version, removing it from active use.
compareVersions()  : array{added: array, removed: array, modified: array}
Compare two versions and return structural differences.
createDraft()  : ServiceResult
Create a new draft version for a workflow definition.
getCurrentVersion()  : WorkflowVersion|null
Get the currently published version for a definition.
getVersionHistory()  : array<string|int, WorkflowVersion>
Get all versions for a definition, newest first.
migrateInstance()  : ServiceResult
Migrate a running instance to a different version.
publish()  : ServiceResult
Publish a draft version, making it the active version.
updateDraft()  : ServiceResult
Update an existing draft version.

Methods

compareVersions()

Compare two versions and return structural differences.

public compareVersions(int $versionId1, int $versionId2) : array{added: array, removed: array, modified: array}
Parameters
$versionId1 : int

First version ID

$versionId2 : int

Second version ID

Return values
array{added: array, removed: array, modified: array}

createDraft()

Create a new draft version for a workflow definition.

public createDraft(int $definitionId, array<string|int, mixed> $definition[, array<string|int, mixed>|null $canvasLayout = null ][, string|null $changeNotes = null ]) : ServiceResult
Parameters
$definitionId : int

Workflow definition to version

$definition : array<string|int, mixed>

Workflow graph (nodes, edges)

$canvasLayout : array<string|int, mixed>|null = null

Optional visual layout data

$changeNotes : string|null = null

Optional notes describing changes

Return values
ServiceResult

migrateInstance()

Migrate a running instance to a different version.

public migrateInstance(int $instanceId, int $targetVersionId, int|null $migratedBy[, array<string|int, mixed>|null $nodeMapping = null ]) : ServiceResult
Parameters
$instanceId : int

Instance to migrate

$targetVersionId : int

Target version (must be published)

$migratedBy : int|null

ID of the user performing migration, or null for a system migration

$nodeMapping : array<string|int, mixed>|null = null

Optional explicit node key mapping

Return values
ServiceResult

updateDraft()

Update an existing draft version.

public updateDraft(int $versionId, array<string|int, mixed> $definition[, array<string|int, mixed>|null $canvasLayout = null ][, string|null $changeNotes = null ]) : ServiceResult
Parameters
$versionId : int

Draft version to update

$definition : array<string|int, mixed>

Updated workflow graph

$canvasLayout : array<string|int, mixed>|null = null

Optional visual layout data

$changeNotes : string|null = null

Optional notes describing changes

Return values
ServiceResult
On this page

Search results