/** * Throw transition events * * @param MachineInterface $machine Machine * @param mixed $object Object * @param StateLineStack $stateLineStack StateLine Stack * @param Transition $transition Transition * * @return $this Self object */ public function dispatchTransitionEvents(MachineInterface $machine, $object, StateLineStack $stateLineStack, Transition $transition) { $this->eventDispatcher->dispatch(ElcodiStateTransitionMachineEvents::ALL_TRANSITIONS, TransitionEvent::create($object, $stateLineStack, $transition)); $this->eventDispatcher->dispatch(str_replace(['{machine_id}', '{state_name}'], [$machine->getId(), $transition->getStart()->getName()], ElcodiStateTransitionMachineEvents::TRANSITION_FROM_STATE), TransitionEvent::create($object, $stateLineStack, $transition)); $this->eventDispatcher->dispatch(str_replace(['{machine_id}', '{state_name}'], [$machine->getId(), $transition->getFinal()->getName()], ElcodiStateTransitionMachineEvents::TRANSITION_TO_STATE), TransitionEvent::create($object, $stateLineStack, $transition)); $this->eventDispatcher->dispatch(str_replace(['{machine_id}', '{transition_name}'], [$machine->getId(), $transition->getName()], ElcodiStateTransitionMachineEvents::TRANSITION), TransitionEvent::create($object, $stateLineStack, $transition)); }
/** * Log transition. * * @param Transition $transition Transition to log * * @return $this Self object */ public function logTransition(Transition $transition) { $this->logger->info('Transition {transition_name} in machine "{machine_id}" from "{state_from}" to "{state_to}"', ['transition_name' => $transition->getName(), 'machine_id' => $this->machine->getId(), 'state_from' => $transition->getStart()->getName(), 'state_to' => $transition->getFinal()->getName()]); }