13 $this->_workflow = $workflow;
21 if(method_exists($this,$method =
'action' . lcfirst($this->status))){
22 $result = call_user_func([$this,$method]);
23 foreach($this->statuses as $id => $status)
if($status[
'result'] == $result){
27 throw new \Exception(
"No change for result '$result'");
33 return $this->_workflow->lockItem($this->_id);
37 return $this->_workflow->unlockItem($this->_id);
41 if($this->_data === null) $this->_data = $this->_workflow->getItemData($this->_id);
46 $this->_data = array_merge($this->data,$value);
47 $this->_workflow->setItemData($this->_id,$value);
51 return $this->_workflow->getItemStatus($this->_id);
55 if(!$this->_workflow->setItemStatus($this->_id,$value))
throw new \
Exception(
"Could not change status to '$value'");
59 return $this->_workflow->getItemStatuses($this->_id);
62 protected function _get($key){
63 return $this->data[$key] ?? null;
66 protected function _set($key,$value){
67 $this->data = [$key => $value];
execute()
Execute the action for the current step.
__construct($workflow, $id)