Skip to content

Commit

Permalink
#22 Add demo.rules for RulesTransformer. Fix demo.transformer name.
Browse files Browse the repository at this point in the history
  • Loading branch information
njoubert-cleverage committed Dec 10, 2024
1 parent 286badf commit c7eb85d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
59 changes: 59 additions & 0 deletions config/packages/process/demo.rules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
clever_age_process:
configurations:
demo.rules:
description: >
A simple process which use RulesTransformer
help: >
Ex: bin/console cleverage:process:execute demo.rules
options:
ui:
source: Bar
target: Foo
tasks:
entry:
service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask'
options:
output:
- order:
origin: marketplace
customer:
id: 123
- order:
origin: e-commerce
- order:
origin: other
outputs: [ transform_value, transform_variable ]
transform_value:
service: '@CleverAge\ProcessBundle\Task\TransformerTask'
options:
transformers:
rules:
rules_set:
- condition: 'value["order"]["origin"] === "marketplace"'
transformers:
property_accessor:
property_path: '[customer][id]'
- condition: 'value["order"]["origin"] === "e-commerce"'
constant: value1234
- default: true
set_null: true
outputs: [ debug ]
transform_variable:
service: '@CleverAge\ProcessBundle\Task\TransformerTask'
options:
transformers:
rules:
use_value_as_variables: true
expression_variables: [ order, customer ]
rules_set:
- condition: 'order["origin"] === "marketplace"'
transformers:
property_accessor:
property_path: '[customer][id]'
- condition: 'order["origin"] === "e-commerce"'
constant: variable1234
- default: true
set_null: true
outputs: [ debug ]
debug:
service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask'
2 changes: 1 addition & 1 deletion config/packages/process/demo.transformer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
clever_age_process:
configurations:
demo.sample:
demo.transformer:
description: >
A simple process which transform data
help: >
Expand Down

0 comments on commit c7eb85d

Please sign in to comment.