catch (UnnecessaryTransitionException
) { // No transition needed, therefore don't create a history entry and return
$stateMachineStateCollection =
new StateMachineStateCollection();
$stateMachineStateCollection->
set('fromPlace',
$fromPlace);
$stateMachineStateCollection->
set('toPlace',
$fromPlace);
return $stateMachineStateCollection;
} $stateMachineHistoryEntity =
[ 'stateMachineId' =>
$toPlace->
getStateMachineId(),
'entityName' =>
$transition->
getEntityName(),
'fromStateId' =>
$fromPlace->
getId(),
'toStateId' =>
$toPlace->
getId(),
'transitionActionName' =>
$transition->
getTransitionName(),
'userId' =>
$context->
getSource() instanceof AdminApiSource ?
$context->
getSource()->
getUserId() : null,
];
if (Feature::
isActive('v6.6.0.0'
)) { $stateMachineHistoryEntity['referencedId'
] =
$transition->
getEntityId();
$stateMachineHistoryEntity['referencedVersionId'
] =
$context->
getVersionId();
} else {