/** * Workflow constructor. * * @param array $config * @throws InvalidConfigException */ public function __construct($config = []) { if (!empty($config['id'])) { $this->_id = $config['id']; unset($config['id']); } else { throw new InvalidConfigException('missing workflow id '); } if (!empty($config[self::PARAM_INITIAL_STATUS_ID])) { $this->_initialStatusId = $config[self::PARAM_INITIAL_STATUS_ID]; unset($config[self::PARAM_INITIAL_STATUS_ID]); } else { throw new InvalidConfigException('missing initial status id'); } parent::__construct($config); }
/** * Status constructor. * * To create a Status you must provide following values * in the $config array passed as argument: * * - **id** : the id for this status. * - **workflowId ** : the id of the workflow this status belongs to. * * Following values are optional : * * - **label** : human readable name for this status. * * @param array $config * @throws InvalidConfigException */ public function __construct($config = []) { if (!empty($config['workflowId'])) { $this->_workflow_id = $config['workflowId']; unset($config['workflowId']); } else { throw new InvalidConfigException('missing workflow id'); } if (!empty($config['id'])) { $this->_id = $config['id']; unset($config['id']); } else { throw new InvalidConfigException('missing status id'); } if (!empty($config['label'])) { $this->_label = $config['label']; unset($config['label']); } parent::__construct($config); }
/** * Creates a Transition object. * * To create a new Transition, you should provide following mandatory values in the * configuration array $config : * * - **start** : the start Status instance * - **end** : the end Status instance * * @see Status * @param array $config * @throws InvalidConfigException */ public function __construct($config = []) { if (!empty($config['start'])) { $this->_startStatus = $config['start']; unset($config['start']); if (!$this->_startStatus instanceof StatusInterface) { throw new WorkflowException('Start status object must implement raoul2000\\workflow\\base\\StatusInterface'); } } else { throw new InvalidConfigException('missing start status'); } if (!empty($config['end'])) { $this->_endStatus = $config['end']; unset($config['end']); if (!$this->_endStatus instanceof StatusInterface) { throw new WorkflowException('End status object must implement raoul2000\\workflow\\base\\StatusInterface'); } } else { throw new InvalidConfigException('missing end status'); } parent::__construct($config); $this->_id = $this->_startStatus->getId() . '-' . $this->_endStatus->getId(); }