You are here

protected function FeatureContext::getLastBooking in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Retrieves the last booking ID.

Return value

int The last booking ID.

Throws

RuntimeException

1 call to FeatureContext::getLastBooking()
FeatureContext::checkUnitLockedByLastBooking in test/features/bootstrap/FeatureContext.php
Checks if one unit is being locked by a booking in a date range.

File

test/features/bootstrap/FeatureContext.php, line 945

Class

FeatureContext
Features context.

Code

protected function getLastBooking() {
  $efq = new EntityFieldQuery();
  $efq
    ->entityCondition('entity_type', 'rooms_booking')
    ->entityOrderBy('entity_id', 'DESC')
    ->range(0, 1);
  $result = $efq
    ->execute();
  if (isset($result['rooms_booking'])) {
    $return = key($result['rooms_booking']);
    return $return;
  }
  else {
    throw new RuntimeException('Unable to find the last booking');
  }
}