You are here

public function LTIToolProviderOutcomesResourceEntityController::deleteMultiple in LTI Tool Provider 7

Delete Resources.

Parameters

array $entities: An array of Resources to delete.

Throws

Exception

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

File

lti_tool_provider_outcomes/LTIToolProviderOutcomesResourceEntityController.class.php, line 104
Entity for outcome resource. Contains all related entity functions. Entity views are found here

Class

LTIToolProviderOutcomesResourceEntityController

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_resource_delete', $entity);

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