You are here

public static function BotchaFormModel::delete in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6.2 model/botcha_form.model.inc \BotchaFormModel::delete()
  2. 6.3 model/form/botcha.form.model.inc \BotchaFormModel::delete()
  3. 7.3 model/form/botcha.form.model.inc \BotchaFormModel::delete()
1 call to BotchaFormModel::delete()
BotchaFormAbstract::delete in controller/botcha_form.controller.inc

File

model/botcha_form.model.inc, line 75
Contains BotchaFormModel class.

Class

BotchaFormModel
@file Contains BotchaFormModel class.

Code

public static function delete($form) {

  // Catching of PDOException helps to avoid WSOD during update use case. The
  // reason is in that form_alter is called before performing an update.
  // @see http://drupal.org/node/1828710
  try {

    // Delete all data related to this form.
    db_delete('botcha_recipebook_form')
      ->condition('form_id', $form->id)
      ->execute();
    db_delete('botcha_form')
      ->condition('id', $form->id)
      ->execute();
  } catch (Exception $e) {
    if ($e instanceof PDOException) {
      watchdog_exception('BOTCHA', $e, 'Please perform an update via update.php or reinstall the BOTCHA module to fix the reason of this warning! %type: !message in %function (line %line of %file).', array(), WATCHDOG_WARNING);
    }
  }
}