workflow - Symfony 4. 工作流程 initial_place 不起作用
问题描述
在 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 未设置为初始值。它是工作流捆绑中的错误吗?我怎么解决这个问题?
解决方案
答案很晚,但是,这就是 Symfony 的工作方式。 null
==initial_place
如果您使用WorkflowInterface
and getMarking($dieselCase)
when db is null
,它将报告该位置['initial']
与您配置的一样。或者如果你使用marking_store: type: 'single_state'
它会报告'initial'
。
'currentPlace' 标记存储只会在您执行$workflow->apply($dieselCase, 'to_review')
推荐阅读
- reactjs - 需要澄清 React 的 JSX 语法
- python - Why is the Average Precision of my TensorFlow model -1.000?
- c# - 远程调试 WinForms 应用程序
- delphi - 在哪里为动态包使用的 DLL 调用 FreeLibrary?
- ios - Crash on Canvas SwiftUI
- python - 如何为每个请求/URL 保存一个输出文件?
- go - 我应该如何避免在微服务架构中多次实现我的方法
- python - 它在python中意味着什么?“苹果” > 30 = 真
- azure - Generics in APIM policy breaks Terraform
- tcl - If 构造中的中断条件