You are here

function rooms_booking_ids in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Get a list of Booking keyed by id and name in value.

File

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

Code

function rooms_booking_ids($conditions = array()) {
  $bookings = array();
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'rooms_booking')
    ->execute();
  if (count($result) > 0) {
    $entities = rooms_booking_load_multiple(array_keys($result['rooms_booking']), $conditions);
    foreach ($entities as $booking) {
      $wrapper = entity_metadata_wrapper('rooms_booking', $booking);
      $bookings[$wrapper->booking_id
        ->value()] = $wrapper->name
        ->value();
    }
  }
  return $bookings;
}