CodeExplorer buildChildRule example
$classes =
array_column($rules, 'rule'
);
$names =
array_column($rules, 'name'
);
$ruleData =
[ 'id' => Uuid::
randomHex(),
'priority' =>
$i,
'name' =>
implode(' + ',
$names),
'description' =>
$context->
getFaker()->
text(),
];
$ruleData['conditions'
][] =
$this->
buildChildRule(null,
(new OrRule())->
assign(['rules' =>
$classes]));
$payload[] =
$ruleData;
} // nested condition
$nestedRule =
new OrRule();
$nestedRuleData =
[ 'id' => Uuid::
randomHex(),
'priority' => 20,
'name' => 'nested rule',