使用mysqli php在数据库中保存symfony / workflow

时间:2017-12-07 08:49:34

标签: php mysql symfony workflow

我是symfony / workflow中的新手,所以我阅读了文档并在我现有的hp项目中完成了我的第一个工作流程,我添加了这样的代码:

$definitionBuilder = new DefinitionBuilder();

$definition = $definitionBuilder->addPlaces(['create_contest', 'approve', 'reject', 'launch_contest','contest_edit','submition','not_submition','pay_contest','pass','full','post_mortem','final_review','fail','final_pass','completed'])

    // Transitions are defined with a unique name, an origin place and a destination place
    ->addTransition(new Transition('pending_contest', 'create_contest','approve','reject'))
    ->addTransition(new Transition('Pending_contest', 'contest_edit', 'approve','reject'))
    ->addTransition(new Transition('admin_approve', 'approve', 'launch_contest'))
    ->addTransition(new Transition('admin_reject', 'reject', 'contest_edit'))
    ->addTransition(new Transition('wait_to_pay', 'launch_contest','pay_contest'))
    ->addTransition(new Transition('submition_phase', 'pay_contest', 'submition','not_submition'))
    ->addTransition(new Transition('review','submition','pass','full'))
    ->addTransition(new Transition('post_mortem', 'not_submition','post_mortem'))
    ->addTransition(new Transition('Post_mortem', 'full', 'post_mortem'))
    ->addTransition(new Transition('final_fixes','pass','final_review'))
    ->addTransition(new Transition('Final_fixes','fail','final_review'))
    ->addTransition(new Transition('fail','final_review','fail'))
    ->addTransition(new Transition('pass','final_review','final_pass'))
    ->addTransition(new Transition('approve','final_pass','completed'))
    ->build();

$marking = new SingleStateMarkingStore('currentState');
$workflow = new Workflow($definition, $marking);

那么......之后我需要做什么?我是否需要添加更多代码,如控制器内容?如何使用过渡?代码我在创建新比赛后添加它,所以我需要调用第一个转换并使用Mysqli将其保存在数据库中 我需要帮助

1 个答案:

答案 0 :(得分:-1)

此处阅读此docs

并尝试此example

可能是你急于询问并错过阅读那些文档“_”