Groups input rows sharing the same value for the aggregate_by column. Each group is made of the first received row
(without the aggregate_columns), plus a sub-array under aggregation_key listing the aggregate_columns values of
every row of the group. The groups are output once all previous tasks are resolved.
- Service:
CleverAge\ProcessBundle\Task\RowAggregatorTask - Blocking task
array: an associative array containing the aggregate_by key and all the aggregate_columns keys, otherwise an
InvalidProcessConfigurationException is thrown
array: list of groups (indexed numerically, in order of first appearance)
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
aggregate_by |
string |
X | Column used to group rows together | |
aggregate_columns |
array |
X | List of columns to collect into the aggregation sub-array | |
aggregation_key |
string |
X | Key of the sub-array containing the aggregated column values |
- Group order lines by order
# Task configuration level
aggregate_rows:
service: '@CleverAge\ProcessBundle\Task\RowAggregatorTask'
options:
aggregate_by: order_id
aggregate_columns: [product, qty]
aggregation_key: linesWith inputs {order_id: 1, customer: X, product: A, qty: 2}, {order_id: 1, customer: X, product: B, qty: 3} and
{order_id: 2, customer: Y, product: C, qty: 1}, the output is:
- { order_id: 1, customer: X, lines: [{ product: A, qty: 2 }, { product: B, qty: 3 }] }
- { order_id: 2, customer: Y, lines: [{ product: C, qty: 1 }] }