You are here

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

Construct the AvailabilityAgent instance.

Parameters

DateTime $start_date: The start date.

DateTime $end_date: The end date.

array $booking_parameters: Parameters to include in the search.

int $booking_units: Number of units to book.

array $valid_states: Valid states to perform the availability search.

array $unit_types: Unit types to perform the search.

boolean $revert_valid_states: If true availability is return if states other than the valid ones exist in date range

File

modules/rooms_booking/includes/rooms_booking.availability_agent.inc, line 107
Contains the AvailabilityAgent.

Class

AvailabilityAgent
An AvailabilityAgent provides access to the availability functionality of Rooms and lets you query for availability, get pricing information and create products that can be bought.

Code

public function __construct($start_date, $end_date, $booking_parameters = array(), $booking_units = 1, $valid_states = array(
  ROOMS_AVAILABLE,
  ROOMS_ON_REQUEST,
  ROOMS_UNCONFIRMED_BOOKINGS,
), $unit_types = array(), $revert_valid_states = FALSE) {
  $this->valid_states = $valid_states;
  $this->start_date = $start_date;

  // For availability purposes the end date is a day earlier than checkout.
  $this->end_date = clone $end_date;
  $this->end_date
    ->sub(new DateInterval('P1D'));
  $this->booking_parameters = $booking_parameters;
  $this->booking_units = $booking_units;
  $this->unit_types = $unit_types;
  $this->revert_valid_states = $revert_valid_states;
}