public function onShopOrder(\Club\ShopBundle\Event\FilterOrderEvent $event)
 {
     $order = $event->getOrder();
     $status = new \Club\ShopBundle\Entity\OrderStatusHistory();
     $status->setOrder($order);
     $status->setOrderStatus($order->getOrderStatus());
     $this->em->persist($status);
     $this->em->flush();
 }
 public function onShopOrder(\Club\ShopBundle\Event\FilterOrderEvent $event)
 {
     $order = $event->getOrder();
     $status = new \Club\ShopBundle\Entity\OrderStatusHistory();
     $status->setOrder($order);
     $status->setOrderStatus($order->getOrderStatus());
     $this->em->persist($status);
     $this->em->flush();
     if ($order->getAmountLeft() == 0) {
         $this->club_shop_order->setOrder($order)->setPaid();
     }
 }
Exemple #3
0
 public function changeStatus(\Club\ShopBundle\Entity\OrderStatus $order_status)
 {
     $this->order->setOrderStatus($order_status);
     $this->em->persist($this->order);
     $status = new \Club\ShopBundle\Entity\OrderStatusHistory();
     $status->setOrder($this->order);
     $status->setOrderStatus($this->order->getOrderStatus());
     $status->setNote($this->order->getNote());
     $this->em->persist($status);
     if ($order_status->getDelivered()) {
         $this->order->setDelivered(true);
         $this->em->persist($this->order);
     } elseif ($order_status->getPaid()) {
         $this->order->setPaid(true);
         $this->em->persist($this->order);
     } elseif ($order_status->getCancelled()) {
         $this->order->setCancelled(true);
         $this->em->persist($this->order);
     }
     $this->em->flush();
     $event = new \Club\ShopBundle\Event\FilterOrderEvent($this->order);
     $this->event_dispatcher->dispatch(\Club\ShopBundle\Event\Events::onOrderChange, $event);
 }