arter/amos-workflow
Composer 安装命令:
composer require arter/amos-workflow
包简介
Sistema AMOS per il workflow
README 文档
README
The module Workflow is used in order to manage workflow status transitions on records useing a workflow. Amos Workflow is based on:
- raoul2000/yii2-workflow
- cornernote/yii2-workflow-manager
Installation
- The preferred way to install this extension is through composer.
Either run
composer require arter/amos-workflow
or add this row
"arter/amos-workflow": "dev-master"
to the require section of your composer.json file.
Add module to your modules config in backend:
'modules' => [ 'workflow' => [ 'class' => 'arter\amos\workflow\AmosWorkflow', ], ],Apply migrations
a. amos-workflow migrations
php yii migrate/up --migrationPath=@vendor/arter/amos-workflow/src/migrationsor add this row to your migrations config in console:
return [ . . . '@vendor/arter/amos-workflow/src/migrations', . . . ];
Configuration
//TODO translate-fix this section
Ogni cambio di stato del workflow viene intercettato come evento e viene scritta un record di log nella tabella workflow_transition_log (vedere WorkflowLogFunctionsBehavior).
Define model workflow
Il workflow classico in amos4 comprende gli stati:
- bozza /draft
- da validare/richiesta pubblicazione
- validato/pubblicato
Per automatizzare/standardizzare alcune operazioni è stata creata in amos-core l'interfaccia WorkflowModelInterface che è bene implementare, insieme ad estendere NotifyRecord per beneficiare ad esempio delle mail automatiche alla richiesta di validazione del modello.
Il workflow del model viene definito tramite il popolamento delle tabelle:
sw_workflow: definizione id del workflow, per convenzione in amos 4 è il nome del model seguito da 'Workflow' es. 'NewsWorkflow'. Definizione dello stato iniziale di default, eventualmente modificabile da interfaccia o tramite migration. Es initial_status_id = 'DRAFT'
sw_status: Definizione degli stati del workflow. Lo stato verrà salvato (come convenzione) nel campo status del model concatendo Workflow_id / status_id ad esempio 'NewsWorkflow/BOZZA'
sw_transition: definizione delle transizioni, ossia di tutti i possibili passaggi di stato. IMPORTANTE: l'errore non esiste la transizione tra stato A e stato B che potreste riscontrare, se avete definito la transizione è in realtà dovuto alla mancanza del permesso dell'utente salvare il modello in quello stato.
sw_metadata: per ogni stato del workflow definisce label sui bottoni di cambio stato, testi dei popup, classi css, ecc. E' possibile anche commentare il passaggio di stato e salvare tale nota/commento nei log di passaggio di stato.
To enable workflow event behavior, insert in your model behavior array eg.
public function behaviors()
{
return ArrayHelper::merge(parent::behaviors(), [
.
.
.
'workflow' => [
'class' => SimpleWorkflowBehavior::className(),
'defaultWorkflowId' => self::NEWS_WORKFLOW,
'propagateErrorsToModel' => true
]
];
}
Widgets
Amos Workflow provides three Widgets:
- WorkflowTransitionButtonsWidget
- WorkflowTransitionStateDescriptorWidget
//TODO explain/example of use for new widgets above
- WorkflowTransitionWidget arter\amos\workflow\widgets\WorkflowTransitionWidget
Draws a section containing model current status and the buttons with possible status to change starting from the current one (reading from sw_metadata).
Comment / notes on status change
If needed, it is possible to show a popup to insert comment/notes on status change; to enable the functionality add in sw_metadata for the transition final status the metadata: key ='comment', value = 1
It is possible to use a global parameter to hide all transition widgets, if the model workflows are bypassed. Insert between your application backend params array:
return [
.
.
.
'hideWorkflowTransitionWidget' => true
.
.
.
];
```
example of use in a form:
<?= WorkflowTransitionWidget::widget([
'form' => $form,
'model' => $model,
'workflowId' => ShowcaseProject::SHOWCASEPROJECT_WORKFLOW,
'classDivIcon' => 'pull-left',
'classDivMessage' => 'pull-left message',
'viewWidgetOnNewRecord' => true,
'translationCategory' => 'amosshowcaseprojects'
]); ?>
arter/amos-workflow 适用场景与选型建议
arter/amos-workflow 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 601 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 10 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「workflow」 「yii2」 「amos」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arter/amos-workflow 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arter/amos-workflow 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arter/amos-workflow 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
A custom URL rule class for Yii 2 which allows to create translated URL rules
Workflow logger
Approval Workflow Engine for Filament
Operational approvals engine for Laravel applications.
Sistema AMOS per le FAQ
统计信息
- 总下载量: 601
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-10-06