Since: 4.0.0

class Workflow

Workflow Class.

Constants

CONDITION_NAMES Since: 4.0.0

Condition to names mapping

CONDITION_PUBLISHED

Every item with a state which has the condition PUBLISHED is visible/active on the page

CONDITION_UNPUBLISHED

Every item with a state which has the condition UNPUBLISHED is not visible/inactive on the page

CONDITION_TRASHED

Every item with a state which has the condition TRASHED is trashed

CONDITION_ARCHIVED

Every item with a state which has the condition ARCHIVED is archived

Properties

protected ComponentInterface $component

The booted component

protected string Since: 4.0.0
$extension

Name of the extension the workflow belong to

protected CMSApplication Since: 4.0.0
$app

Application Object

protected DatabaseDriver Since: 4.0.0
$db

Database Driver

Methods

__construct(string $extension, CMSApplication|null $app = null, DatabaseDriver|null $db = null)

Class constructor

string
getConditionName(int $value)

Returns the translated condition name, based on the given number

getComponent()

Returns the booted component

bool|int
getDefaultStageByCategory(int $catId = 0)

Try to load a workflow default stage by category ID.

object
getValidTransition(array $pks, int $transitionId)

Check if a transition can be executed

bool
executeTransition(array $pks, int $transitionId)

Executes a transition to change the current state in the association table

bool
createAssociation(int $pk, int $state)

Creates an association for the workflow_associations table

bool
updateAssociations(array $pks, int $state)

Update an existing association with a new state

bool
deleteAssociation(array $pks)

Removes associations from the workflow_associations table

stdClass|null
getAssociation(int $itemId)

Loads an existing association item with state and item ID

Details

__construct(string $extension, CMSApplication|null $app = null, DatabaseDriver|null $db = null)

Since: 4.0.0

Class constructor

Parameters

string $extension

The extension name

CMSApplication|null $app

Application Object

DatabaseDriver|null $db

Database Driver Object

string getConditionName(int $value)

Since: 4.0.0

Returns the translated condition name, based on the given number

Parameters

int $value

The condition ID

Return Value

string

protected ComponentInterface getComponent()

Since: 4.0.0

Returns the booted component

Return Value

ComponentInterface

bool|int getDefaultStageByCategory(int $catId = 0)

Since: 4.0.0

Try to load a workflow default stage by category ID.

Parameters

int $catId

The category ID.

Return Value

bool|int

An integer, holding the stage ID or false

object getValidTransition(array $pks, int $transitionId)

Check if a transition can be executed

Parameters

array $pks

The item IDs, which should use the transition

int $transitionId

The transition which should be executed

Return Value

object

| null

bool executeTransition(array $pks, int $transitionId)

Executes a transition to change the current state in the association table

Parameters

array $pks

The item IDs, which should use the transition

int $transitionId

The transition which should be executed

Return Value

bool

bool createAssociation(int $pk, int $state)

Since: 4.0.0

Creates an association for the workflow_associations table

Parameters

int $pk

ID of the item

int $state

ID of state

Return Value

bool

bool updateAssociations(array $pks, int $state)

Since: 4.0.0

Update an existing association with a new state

Parameters

array $pks

An Array of item IDs which should be changed

int $state

The new state ID

Return Value

bool

bool deleteAssociation(array $pks)

Since: 4.0.0

Removes associations from the workflow_associations table

Parameters

array $pks

ID of content

Return Value

bool

stdClass|null getAssociation(int $itemId)

Since: 4.0.0

Loads an existing association item with state and item ID

Parameters

int $itemId

The item ID to load

Return Value

stdClass|null