You are here

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

Create a booking - we first set up the values that are specific to our booking but then also go through the EntityAPIController function.

Parameters

array $values: The booking to create properties.

Return value

object A booking object with all default fields initialized.

Overrides EntityAPIController::create

File

modules/rooms_booking/rooms_booking.module, line 1056
Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.

Class

RoomsBookingController
The Controller for RoomsBooking entities.

Code

public function create(array $values = array()) {
  $booking_type = rooms_booking_type_load($values['type'], TRUE);

  // Add values that are specific to our Room.
  $values += array(
    'booking_id' => '',
    'is_new' => TRUE,
    'title' => '',
    'created' => '',
    'changed' => '',
    'order_id' => '',
    'data' => array(),
  );
  $booking = parent::create($values);
  return $booking;
}