异常错误表明找不到一个存在的类,该类已在项目中使用。这是WF配置:
first_workflow_name:
type: 'workflow'
supports:
- FooBundle\Entity\Document
marking_store:
type: 'multiple_state'
arguments:
- 'currentState'
second_workflow_name:
type: 'workflow'
supports:
- FooBundle\Entity\Document
marking_store:
type: 'multiple_state'
arguments:
- 'currentState'
,这里是记录的异常:
[2018-09-07 09:11:38]请求。关键:未捕获的PHP异常 Symfony \ Component \ Workflow \ Exception \ InvalidArgumentException:“无法 查找类“ FooBundle \ Entity \ Document”的工作流程。”
public function getFooAction(
$id,
Registry $workflows
) {
$document = $this->getDoctrine()
->getRepository('FooBundle:Document')
->findOneBy(['id' => $id]);
if (!$document) {
throw $this->createNotFoundException(
'No Document found for id '.$id
);
}
$w = $workflows->get($document, 'second_workflow_name');
}
答案 0 :(得分:0)
在树枝上写:
workflow_can(you_variable,'second_workflow_name','arguments')
代替:
workflow_can(you_variable,'arguments','second_workflow_name')