Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chunkwan/workflow-reviser
The WorkflowReviser integrates simple transition conditions into the Symfony Workflow component. This means easy-to-implement and feature-rich transition checks in your Symfony application!
https://github.com/chunkwan/workflow-reviser
symfony symfony-bundle symfony-component symfony-workflow workflow
Last synced: about 2 months ago
JSON representation
The WorkflowReviser integrates simple transition conditions into the Symfony Workflow component. This means easy-to-implement and feature-rich transition checks in your Symfony application!
- Host: GitHub
- URL: https://github.com/chunkwan/workflow-reviser
- Owner: chunkwan
- License: mit
- Created: 2020-12-22T15:09:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-08T14:46:33.000Z (about 4 years ago)
- Last Synced: 2023-08-21T08:51:45.899Z (over 1 year ago)
- Topics: symfony, symfony-bundle, symfony-component, symfony-workflow, workflow
- Language: PHP
- Homepage:
- Size: 86.9 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Workflow Reviser
The WorkflowReviser integrates simple transition conditions into the Symfony Workflow component. This means
easy-to-implement and feature-rich transition checks in your Symfony application!## Example:
```phpt
// config/packages/workflow.php
// Reknil\WorkflowReviser\Component\TransitionRule\CountEqual;
// Reknil\WorkflowReviser\Component\TransitionRule\NotNull;
// Reknil\WorkflowReviser\Component\WorkflowReviser;$container->loadFromExtension('framework', [
// ...
'workflows' => [
'blog_publishing' => [
'supports' => [BlogPost::class],
// ...
'places' => [
'draft',
'reviewed',
'rejected',
'published',
],
'transitions' => [
'to_review' => [
'from' => 'draft',
'to' => 'review',
'metadata' => [
# The transition is allowed only if the all check is success:
# Title and Short Description is filled - NotNull
# Quantity of images for post equal two - CountEqual
# Comments for post more then 5 - CountMore
WorkflowReviser::class => [
NotNull::class => [
// you can pass one or more property (field) of entity class
'title' => "Title cannot be blank",
'shortDescription' => "Short Description must be filled",
],
CountEqual::class => [
'images' => [2, ' Quantity of images for post must be two'],
],
CountMore::class => [
'comments' => [5, ' Comments for post must be more then 5'],
],
],
],
],
// ...
],
],
],
]);
```## TransitionRule List:
#### DateTime:
````phpt
// ...
DateTimeEqual::class => [
'createdAt' => [new \DateTime('2020-12-15T15:03:00'), 'Datetime must be equal!'],
],
DateTimeUntil::class => [
'createdAt' => [new \DateTime('2020-12-15T15:03:00'), 'Datetime must be untill!'],
],
DateTimeBefore::class => [
'createdAt' => [new \DateTime('2020-12-15T15:03:00'), 'Datetime must be before!'],
],
// ...
````