From c7eb85d21e514e63b33ebaec90abb47de08dbc46 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 10 Dec 2024 16:49:05 +0100 Subject: [PATCH] #22 Add demo.rules for RulesTransformer. Fix demo.transformer name. --- config/packages/process/demo.rules.yaml | 59 +++++++++++++++++++ config/packages/process/demo.transformer.yaml | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 config/packages/process/demo.rules.yaml diff --git a/config/packages/process/demo.rules.yaml b/config/packages/process/demo.rules.yaml new file mode 100644 index 0000000..853d4e1 --- /dev/null +++ b/config/packages/process/demo.rules.yaml @@ -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' diff --git a/config/packages/process/demo.transformer.yaml b/config/packages/process/demo.transformer.yaml index 0a295c7..bd62107 100644 --- a/config/packages/process/demo.transformer.yaml +++ b/config/packages/process/demo.transformer.yaml @@ -1,6 +1,6 @@ clever_age_process: configurations: - demo.sample: + demo.transformer: description: > A simple process which transform data help: >