/**
  * Send email
  *
  * @param TransitionEvent $event Event
  */
 public function sendOrderShippedEmail(TransitionEvent $event)
 {
     /**
      * @var OrderInterface $order
      */
     $order = $event->getObject();
     $customer = $order->getCustomer();
     $this->sendEmail('order_shipped', ['order' => $order, 'customer' => $customer], $customer->getEmail());
 }
Ejemplo n.º 2
0
 /**
  * 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));
 }