/**
  * Validates all discounts the order in the event has and removes
  * invalid discounts from the basket.
  *
  * @todo  Add notification when discount is removed
  *
  * @param Event $event The event object
  */
 public function validateDiscount(Event\Event $event)
 {
     $order = $event->getOrder();
     $discountValidator = $this->get('discount.validator')->setOrder($order);
     foreach ($order->discounts as $orderDiscount) {
         try {
             if ($orderDiscount->code) {
                 $orderDiscount = $discountValidator->validate($orderDiscount->code, false);
             }
         } catch (OrderValidityException $e) {
             $order->discounts->remove($orderDiscount);
             if ($event instanceof Event\Event\AssemblerEvent) {
                 $event->getAssembler()->dispatchEvent();
             }
             $this->get('http.session')->getFlashBag()->add('info', sprintf('Discount `%s` was removed: %s', $orderDiscount->code, $e->getMessage()));
         }
     }
 }