You are here

public function LTIToolProviderOutcomesEntityController::deleteMultiple in LTI Tool Provider 7

Delete Outcomes.

Parameters

array $entities: An array of Outcomes entities to delete.

Throws

Exception

1 call to LTIToolProviderOutcomesEntityController::deleteMultiple()
LTIToolProviderOutcomesEntityController::delete in lti_tool_provider_outcomes/LTIToolProviderOutcomesEntityController.class.php

File

lti_tool_provider_outcomes/LTIToolProviderOutcomesEntityController.class.php, line 102
Entity controller class for outcomes.

Class

LTIToolProviderOutcomesEntityController

Code

public function deleteMultiple($entities) {
  $ids = array();
  if (!empty($entities)) {
    $transaction = db_transaction();
    try {
      foreach ($entities as $entity) {
        module_invoke_all('lti_tool_provider_outcomes_delete', $entity);

        // Invoke hook_entity_delete().
        module_invoke_all('entity_delete', $entity, 'lti_tool_provider_outcomes');
        field_attach_delete('lti_tool_provider_outcomes', $entity);
        $ids[] = $entity->lti_tool_provider_outcomes_id;
      }
      db_delete('lti_tool_provider_outcomes')
        ->condition('lti_tool_provider_outcomes_id', $ids, 'IN')
        ->execute();
    } catch (Exception $e) {
      $transaction
        ->rollback();
      watchdog_exception('lti_tool_provider_outcomes', $e);
      throw $e;
    }
  }
}