$states =
$this->stateRepository->
search($criteria,
$context);
$sides =
[ StateMachineStateChangeEvent::STATE_MACHINE_TRANSITION_SIDE_ENTER,
StateMachineStateChangeEvent::STATE_MACHINE_TRANSITION_SIDE_LEAVE,
];
/** @var StateMachineStateEntity $state */
foreach ($states as $state) { foreach ($sides as $side) { $machine =
$state->
getStateMachine();
if (!
$machine) { continue;
} $name =
implode('.',
[ $side,
$machine->
getTechnicalName(),
$state->
getTechnicalName(),
]);
$definition =
$this->businessEventCollector->
define(OrderStateMachineStateChangeEvent::
class,
$name);