Example #1
0
 /**
  * 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
  * @throws WorkflowException
  */
 public function __construct($config = [])
 {
     if (!empty($config['start'])) {
         $this->_startStatus = $config['start'];
         unset($config['start']);
         if (!$this->_startStatus instanceof Status) {
             throw new WorkflowException('Start status must be an instance of Status');
         }
     } else {
         throw new InvalidConfigException('missing start status');
     }
     if (!empty($config['end'])) {
         $this->_endStatus = $config['end'];
         unset($config['end']);
         if (!$this->_endStatus instanceof Status) {
             throw new WorkflowException('End status must be an instance of Status');
         }
     } else {
         throw new InvalidConfigException('missing end status');
     }
     if (!empty($config['label'])) {
         $this->_label = $config['label'];
         unset($config['label']);
     }
     parent::__construct($config);
     $this->_id = $this->_startStatus->getId() . '-' . $this->_endStatus->getId();
 }
Example #2
0
 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);
 }
Example #3
0
 /**
  * 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);
 }