You are here

public function UnitCalendar::removeEvents in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Given an array of events removes events from the calendar setting the value to the default.

Parameters

BookingEventInterface[] $events: The events to remove from the database - an array of Booking Events

Overrides UnitCalendarInterface::removeEvents

File

modules/rooms_availability/includes/rooms_availability.unit_calendar.inc, line 39
Class UnitCalendar Handles querying and updating the availability information relative to a single bookable unit.

Class

UnitCalendar
@file Class UnitCalendar Handles querying and updating the availability information relative to a single bookable unit.

Code

public function removeEvents($events) {
  $events_to_delete = array();
  foreach ($events as $event) {

    // Break any locks.
    $event
      ->unlock();

    // Set the events to the default state.
    $event->id = $this->default_state;
    $events_to_delete[] = $event;
  }
  $this
    ->updateCalendar($events_to_delete);
}