在workflow.yml中,我定义了initial_place。
framework:
workflows:
case_workflow:
type: 'workflow' # or 'state_machine'
audit_trail:
enabled: true
marking_store:
type: 'multiple_state' # or 'single_state'
arguments:
- 'currentPlace'
supports:
- App\Entity\Cases\CoreCase
initial_place: initial
places:
- initial
- review
- rejected
- published
transitions:
to_review:
from: initial
to: review
publish:
from: review
to: published
reject:
from: review
to: rejected
在实体中我定义了属性
/**
* @ORM\Column(type="string", length=50)
*/
private $currentPlace;
在控制器中,我创建实体并将其持久化
$dieselCase = new DieselCase();
$dieselCase->setUser($account);
$dieselCase->setCustomer($account);
$em->persist($dieselCase);
$em->flush();
但是currentPlace未被设置为initial。它是工作流捆绑包中的错误吗?我该如何解决这个问题?
答案 0 :(得分:0)
答案很晚,但是,这是Symfony的工作方式。 null
== initial_place
如果在数据库为WorkflowInterface
时使用getMarking($dieselCase)
和null
,它将报告您配置的位置为['initial']
。或者,如果您使用marking_store: type: 'single_state'
,它将报告'initial'
。
仅当您执行$workflow->apply($dieselCase, 'to_review')