Commit a9fbd9a3 authored by Adrian Vazquez's avatar Adrian Vazquez Committed by Pedro Cambra
Browse files

Issue #3192100 by thetwentyseven: Error: Call to a member function get() on...

Issue #3192100 by thetwentyseven: Error: Call to a member function get() on null - when removing orders that have tickets attached
parent e5faf25a
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ class TicketSubscriber implements EventSubscriberInterface {
    /** @var \Drupal\commerce_ticketing\CommerceTicketInterface $ticket */
    $ticket = $event->getTicket();
    $order = $ticket->getOrder();
    if ($order){
      $existing_tickets = $order->get('tickets')->getValue();
      foreach ($existing_tickets as $key => $existing_ticket) {
        if ($existing_ticket['target_id'] == $ticket->id()) {
@@ -64,5 +65,6 @@ class TicketSubscriber implements EventSubscriberInterface {

      $order->save();
    }
  }

}