protected function getPayloadIdentifier(ProcessStateInterface $process_state)
 {
     $identifier_path = $this->options->get('identifier_payload_path', false);
     $jmes_path_runtime = new AstRuntime();
     $identifier = $jmes_path_runtime($identifier_path, $process_state->getPayload());
     if (!$identifier) {
         throw new RuntimeError('Unable to resolve required "identifier" from payload-path:' . $identifier_path . ' within ' . $process_state->getExecutionContext()->getStateMachineName());
     }
     return $identifier;
 }
 protected function createCommands(ProcessStateInterface $process_state)
 {
     $commands = [];
     $payload = $process_state->getPayload();
     foreach ($payload['affected_entities'] as $affected_entity) {
         $origin_state = $payload['origin_state'];
         $type_prefix = $affected_entity['type_prefix'];
         // @todo handling for transition based on type as well as state
         $transitions = $this->transition_map->get($type_prefix);
         if (isset($transitions[$origin_state])) {
             $command_class = $transitions['command'];
             $aggregate_root_type = $this->aggregate_root_type_map->getItem($type_prefix);
             $commands[] = new $command_class(['aggregate_root_type' => get_class($aggregate_root_type), 'aggregate_root_identifier' => $affected_entity['identifier'], 'known_revision' => $affected_entity['revision'], 'current_state_name' => $affected_entity['state'], 'event_name' => $transitions[$origin_state]]);
         }
     }
     return $commands;
 }