The example shows how to organize some nodes into logical groups. It is just a visual thing.
mkdir ~/pvm-grouping
cd ~/pvm-grouping
composer req formapro/pvm:0.4.x-dev makasim/values:0.5.x-dev
# create such file with the code below
php grouping.php
grouping.php
<?php
use Formapro\Pvm\ProcessBuilder;
require_once __DIR__.'/vendor/autoload.php';
$process = (new ProcessBuilder())
->createNode('foo_1_task', 'a_behavior')->setOption('group', 'foo')->end()
->createNode('foo_2_task', 'a_behavior')->setOption('group', 'foo')->end()
->createNode('foo_3_task', 'a_behavior')->setOption('group', 'foo')->end()
->createNode('bar_1_task', 'a_behavior')->setOption('group', 'bar')->end()
->createNode('bar_2_task', 'a_behavior')->setOption('group', 'bar')->end()
->createTransition('foo_1_task', 'foo_2_task')->end()
->createTransition('foo_2_task', 'foo_3_task')->end()
->createTransition('foo_2_task', 'bar_2_task')->end()
->createTransition('bar_1_task', 'bar_2_task')->end()
->createStartTransition('foo_1_task')->end()
->createStartTransition('bar_1_task')->end()
->getProcess()
;
{ "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Process.json", "id": "ec923a59-9694-454a-aa7b-298a65b2fc7b", "nodes": { "foo_1_task": { "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json", "id": "foo_1_task", "behavior": "a_behavior", "option": { "group": "foo" } }, "foo_2_task": { "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json", "id": "foo_2_task", "behavior": "a_behavior", "option": { "group": "foo" } }, "foo_3_task": { "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json", "id": "foo_3_task", "behavior": "a_behavior", "option": { "group": "foo" } }, "bar_1_task": { "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json", "id": "bar_1_task", "behavior": "a_behavior", "option": { "group": "bar" } }, "bar_2_task": { "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json", "id": "bar_2_task", "behavior": "a_behavior", "option": { "group": "bar" } } }, "transitions": { "4206f0d3-5173-4a4c-8813-d01131d6c5f1": { "id": "4206f0d3-5173-4a4c-8813-d01131d6c5f1", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "from": "foo_1_task", "to": "foo_2_task" }, "591949d5-0001-4148-a7f2-90cfe80131fb": { "id": "591949d5-0001-4148-a7f2-90cfe80131fb", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "from": "foo_2_task", "to": "foo_3_task" }, "23f49192-79e0-4ed2-a4bc-ffb74ecaafa6": { "id": "23f49192-79e0-4ed2-a4bc-ffb74ecaafa6", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "from": "foo_2_task", "to": "bar_2_task" }, "1c0466d5-9376-4684-b922-5f8b6a8f4c47": { "id": "1c0466d5-9376-4684-b922-5f8b6a8f4c47", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "from": "bar_1_task", "to": "bar_2_task" }, "2457707e-1998-4be0-82c1-d6ba824347b8": { "id": "2457707e-1998-4be0-82c1-d6ba824347b8", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "to": "foo_1_task" }, "13ba48da-2886-4105-b6b8-1e555491bd29": { "id": "13ba48da-2886-4105-b6b8-1e555491bd29", "weight": 1, "async": false, "active": true, "schema": "http:\/\/pvm.forma-pro.com\/schemas\/Transition.json", "to": "bar_1_task" } }, "outTransitions": { "foo_1_task": [ "4206f0d3-5173-4a4c-8813-d01131d6c5f1" ], "foo_2_task": [ "591949d5-0001-4148-a7f2-90cfe80131fb", "23f49192-79e0-4ed2-a4bc-ffb74ecaafa6" ], "bar_1_task": [ "1c0466d5-9376-4684-b922-5f8b6a8f4c47" ] }, "inTransitions": { "foo_2_task": [ "4206f0d3-5173-4a4c-8813-d01131d6c5f1" ], "foo_3_task": [ "591949d5-0001-4148-a7f2-90cfe80131fb" ], "bar_2_task": [ "23f49192-79e0-4ed2-a4bc-ffb74ecaafa6", "1c0466d5-9376-4684-b922-5f8b6a8f4c47" ], "foo_1_task": [ "2457707e-1998-4be0-82c1-d6ba824347b8" ], "bar_1_task": [ "13ba48da-2886-4105-b6b8-1e555491bd29" ] } }