You are here

function _uuid_services_entity_delete in Universally Unique IDentifier 7

Callback for the 'delete' method.

See also

entity_uuid_delete()

1 string reference to '_uuid_services_entity_delete'
uuid_services_services_resources_alter in uuid_services/uuid_services.module
Implements hook_services_resources_alter().

File

uuid_services/uuid_services.module, line 194
UUID Services module functions.

Code

function _uuid_services_entity_delete($entity_type, $uuid) {
  try {
    $uuid_exist = (bool) entity_get_id_by_uuid($entity_type, array(
      $uuid,
    ));
    if (!$uuid_exist) {

      /* UUID not found. Don't try to delete something that doesn't exist. */
      $args = array(
        '@uuid' => $uuid,
        '@type' => $entity_type,
      );
      watchdog('uuid_services', 'UUID @uuid not found for entity type @type', $args, WATCHDOG_WARNING);
      return TRUE;
    }
    $return = entity_uuid_delete($entity_type, $uuid) !== FALSE;
    return $return;
  } catch (Exception $exception) {
    watchdog_exception('uuid_services', $exception);
    return services_error($exception, 406, $uuid);
  }
}