Closed ilbassa closed 4 years ago
The solution I found is to detach the old behaviour and to attach the new behaviour. I also change the scenario to validate the new attribute
['STATO', WorkflowValidator::class, 'on' => self::SCENARIO_DEFAULT],
['STATO_INTERNO', WorkflowValidator::class, 'on' => self::SCENARIO_BACKOFFICE],
if($this->statusEquals(DomandeWorkflow::STATUS_PROTOCOLLATA)){
$this->detachBehavior('simpleWorkflow');
$this->attachBehavior('backofficeWorkflow',[
'class' => SimpleWorkflowBehavior::class,
'defaultWorkflowId' => 'DomandeWorkflowBackoffice',
'statusAttribute' => 'STATO_INTERNO',
'propagateErrorsToModel' => true,
]);
$this->scenario = self::SCENARIO_BACKOFFFICE;
}
I have problem validating the status attribute of two workflow attached to a model.
Saving the model it try to validate the passage from status of workflow 1 (STATO attribute) to status of workflow 2 (STATO_INTERNO attribute), the error is: {"STATO_INTERNO":["Workflow validation failed : No transition found between status DomandeWorkflow/VALIDATA and DomandeWorkflowBackoffice/DALAVORARE"]}
How I can not validate passage from a workflow to another?