public static function BotchaRecipeModel::getRecipes in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6.2 model/botcha_recipe.model.inc \BotchaRecipeModel::getRecipes()
- 6.3 model/recipe/botcha.recipe.model.inc \BotchaRecipeModel::getRecipes()
- 7.3 model/recipe/botcha.recipe.model.inc \BotchaRecipeModel::getRecipes()
2 calls to BotchaRecipeModel::getRecipes()
- Botcha::getRecipes in controller/
botcha.controller.inc - Get a list of all BOTCHA recipes objects.
- BotchaRecipeModel::getRecipe in model/
botcha_recipe.model.inc
File
- model/
botcha_recipe.model.inc, line 14 - Contains BotchaRecipeModel class.
Class
- BotchaRecipeModel
- @file Contains BotchaRecipeModel class.
Code
public static function getRecipes($parameters = NULL) {
$recipes = db_select('botcha_recipe', 'br')
->fields('br');
if (!empty($parameters['recipes'])) {
foreach ((array) $parameters['recipes'] as $recipe_id) {
$recipes
->condition('id', $recipe_id, 'IN');
}
}
// 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 {
$result = $recipes
->execute()
->fetchAllAssoc('id');
} 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);
$result = array();
}
}
return $result;
}