You are here

public function CommercePricelistListController::delete in Commerce Pricelist 7

Implements EntityAPIControllerInterface.

Parameters

$transaction: Optionally a DatabaseTransaction object to use. Allows overrides to pass in their transaction object.

Overrides EntityAPIController::delete

File

includes/commerce_pricelist_list.controller.inc, line 46
Contains CommercePricelistListController.

Class

CommercePricelistListController
Handles CRUD for Pricelists.

Code

public function delete($ids, DatabaseTransaction $transaction = NULL) {
  parent::delete($ids, $transaction);

  // Delete orphan pricelist items.
  $query = db_select('commerce_pricelist_list', 'l')
    ->fields('l', array(
    'item_id',
  ))
    ->condition('list_id', $ids, 'IN')
    ->execute();
  $pricelist_items = $query
    ->fetchAllKeyed();
  entity_delete_multiple('commerce_pricelist_item', $pricelist_items);
}