raoul2000\workflow\base\Transition::__construct PHP Method

__construct() public method

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 also: Status
public __construct ( array $config = [] )
$config array
    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();
    }