public function EntityAPIController::delete

cis7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)
cle7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)
elmsmedia7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)
icor7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)
meedjum_blog7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)
mooc7 entity.controller.inc public EntityAPIController::delete($ids, DatabaseTransaction $transaction = NULL)

Implements EntityAPIControllerInterface.

Parameters

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

Overrides EntityAPIControllerInterface::delete

1 method overrides EntityAPIController::delete()
EntityAPIControllerExportable::delete in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Overridden to care about reverted entities.

File

sites/all/modules/ulmus/entity/includes/entity.controller.inc, line 370
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIController
A controller implementing EntityAPIControllerInterface for the database.

Code

public function delete($ids, DatabaseTransaction $transaction = NULL) {
  $entities = $ids ? $this->load($ids) : FALSE;
  if (!$entities) {
    // Do nothing, in case invalid or no ids have been passed.
    return;
  }
  $transaction = isset($transaction) ? $transaction : db_transaction();

  try {
    $ids = array_keys($entities);

    db_delete($this->entityInfo['base table'])->condition($this->idKey, $ids, 'IN')->execute();

    if (isset($this->revisionTable)) {
      db_delete($this->revisionTable)->condition($this->idKey, $ids, 'IN')->execute();
    }
    // Reset the cache as soon as the changes have been applied.
    $this->resetCache($ids);

    foreach ($entities as $id => $entity) {
      $this->invoke('delete', $entity);
    }
    // Ignore slave server temporarily.
    db_ignore_slave();
  }
  catch (Exception $e) {
    $transaction->rollback();
    watchdog_exception($this->entityType, $e);
    throw $e;
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.