function rooms_pricing_update_7003 in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Remove orphaned rows from rooms_pricing table.
File
- modules/
rooms_pricing/ rooms_pricing.install, line 277 - Install for Rooms Pricing module - sets up the main Rooms Pricing table
Code
function rooms_pricing_update_7003() {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'rooms_unit')
->addMetaData('account', user_load(1));
$result = $query
->execute();
$delete = db_delete('rooms_pricing');
if (isset($result['rooms_unit']) && !empty($result['rooms_unit'])) {
$ids = array_keys($result['rooms_unit']);
$delete
->condition('unit_id', $ids, 'NOT IN');
}
$delete
->execute();
return t('Removed orphaned rows from rooms_pricing table');
}