PHP Class ezcWorkflowDefinitionStorageXml, Workflow

The definitions are stored inside the directory specified to the constructor with the name: [workflowName]_[workflowVersion].xml where the name of the workflow has dots and spaces replaced by '_'.
Inheritance: implements ezcWorkflowDefinitionStorage
Show file Open project: zetacomponents/workflow Class Usage Examples

Protected Properties

Property Type Description
$directory string The directory that holds the XML files.

Public Methods

Method Description
__construct ( string $directory = '' ) Constructs a new definition loader that loads definitions from $directory.
conditionToXml ( ezcWorkflowCondition $condition, DOMDocument $document ) : DOMElement "Convert" an ezcWorkflowCondition object into an DOMElement object.
loadByName ( string $workflowName, integer $workflowVersion ) : ezcWorkflow Load a workflow definition from a file.
loadFromDocument ( DOMDocument $document ) : ezcWorkflow Load a workflow definition from a DOMDocument.
save ( ezcWorkflow $workflow ) Save a workflow definition to a file.
saveToDocument ( ezcWorkflow $workflow, integer $workflowVersion ) : DOMDocument Save a workflow definition to a DOMDocument.
variableToXml ( mixed $variable, DOMDocument $document ) : DOMElement "Convert" a PHP variable into an DOMElement object.
xmlToCondition ( DOMElement $element ) : ezcWorkflowCondition "Convert" an DOMElement object into an ezcWorkflowCondition object.
xmlToVariable ( DOMElement $element ) : mixed "Convert" an DOMElement object into a PHP variable.

Protected Methods

Method Description
getCurrentVersion ( string $workflowName ) : integer Returns the current version number for a given workflow name.
getFilename ( string $workflowName, integer $workflowVersion ) : string Returns the filename with path for given workflow name and version.
getFilesystemWorkflowName ( string $workflowName ) : string Returns a safe filesystem name for a given workflow.

Method Details

__construct() public method

$directory must contain the trailing '/'
public __construct ( string $directory = '' )
$directory string The directory that holds the XML files.

conditionToXml() public static method

"Convert" an ezcWorkflowCondition object into an DOMElement object.
public static conditionToXml ( ezcWorkflowCondition $condition, DOMDocument $document ) : DOMElement
$condition ezcWorkflowCondition
$document DOMDocument
return DOMElement

getCurrentVersion() protected method

Returns the current version number for a given workflow name.
protected getCurrentVersion ( string $workflowName ) : integer
$workflowName string
return integer

getFilename() protected method

The name of the workflow file is of the format [workFlowName]_[workFlowVersion].xml
protected getFilename ( string $workflowName, integer $workflowVersion ) : string
$workflowName string
$workflowVersion integer
return string

getFilesystemWorkflowName() protected method

This method replaces whitespace and '.' with '_'.
protected getFilesystemWorkflowName ( string $workflowName ) : string
$workflowName string
return string

loadByName() public method

When the $workflowVersion argument is omitted, the most recent version is loaded.
public loadByName ( string $workflowName, integer $workflowVersion ) : ezcWorkflow
$workflowName string
$workflowVersion integer
return ezcWorkflow

loadFromDocument() public method

Load a workflow definition from a DOMDocument.
public loadFromDocument ( DOMDocument $document ) : ezcWorkflow
$document DOMDocument
return ezcWorkflow

save() public method

Save a workflow definition to a file.
public save ( ezcWorkflow $workflow )
$workflow ezcWorkflow

saveToDocument() public method

Save a workflow definition to a DOMDocument.
public saveToDocument ( ezcWorkflow $workflow, integer $workflowVersion ) : DOMDocument
$workflow ezcWorkflow
$workflowVersion integer
return DOMDocument

variableToXml() public static method

"Convert" a PHP variable into an DOMElement object.
public static variableToXml ( mixed $variable, DOMDocument $document ) : DOMElement
$variable mixed
$document DOMDocument
return DOMElement

xmlToCondition() public static method

"Convert" an DOMElement object into an ezcWorkflowCondition object.
public static xmlToCondition ( DOMElement $element ) : ezcWorkflowCondition
$element DOMElement
return ezcWorkflowCondition

xmlToVariable() public static method

"Convert" an DOMElement object into a PHP variable.
public static xmlToVariable ( DOMElement $element ) : mixed
$element DOMElement
return mixed

Property Details

$directory protected property

The directory that holds the XML files.
protected string $directory
return string