Bitrix API

PaymentWorkflow extends Workflow

FinalYes

Base class for simple business processes (workflows).

Usage:

$workflow = new PublishArticleWorkflow; $workflow->getStage(); // ArticleStage::DRAFT if ($workflow->canSwitchToStage(ArticleStage::PUBLISHED)) { $workflow->setStage(ArticleStage::PUBLISHED); } $workflow->atStage(ArticleStage::PUBLISHED); // true

Table of Contents

Methods

__construct()  : mixed
atStage()  : bool
Check if workflow in $currentStage
canSwitchToStage()  : bool
Check if transition from current stage to next stage allowed.
createFrom()  : PaymentWorkflow
getEntityId()  : int
Returns current entity identifier
getInitialStage()  : string
Returns initial entity stage
getStage()  : string
Fetches current stage from database
getStages()  : array<string|int, string>
Returns list of all available stages
getWorkflowCode()  : string
Returns unique workflow code
resetStage()  : bool
Removes stage record for current entity, so entity forces initialing state
setStage()  : bool
Tries to apply next stage

Methods

__construct()

public __construct(Payment $payment) : mixed
Parameters
$payment : Payment

atStage()

Check if workflow in $currentStage

public atStage(string $currentStage) : bool
Parameters
$currentStage : string
Return values
bool

canSwitchToStage()

Check if transition from current stage to next stage allowed.

public canSwitchToStage(string $nextStage) : bool
Parameters
$nextStage : string
Tags
inheritDoc
Return values
bool

getEntityId()

Returns current entity identifier

public getEntityId() : int
Tags
inheritDoc
Return values
int

getInitialStage()

Returns initial entity stage

public getInitialStage() : string
Tags
inheritDoc
Return values
string

getStage()

Fetches current stage from database

public getStage() : string
Return values
string

getStages()

Returns list of all available stages

public static getStages() : array<string|int, string>
Tags
inheritDoc
Return values
array<string|int, string>

getWorkflowCode()

Returns unique workflow code

public static getWorkflowCode() : string
Tags
inheritDoc
Return values
string

resetStage()

Removes stage record for current entity, so entity forces initialing state

public resetStage() : bool
Return values
bool

true if record removed or already not exists, false otherwise

setStage()

Tries to apply next stage

public setStage(string $nextStage) : bool
Parameters
$nextStage : string
Return values
bool

true if transition allowed and stage saved, false otherwise


        
On this page

Search results