public static function BotchaModel::getRecipebooksRecipes in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6.2 model/botcha.model.inc \BotchaModel::getRecipebooksRecipes()
- 6.3 model/application/botcha.application.model.inc \BotchaModel::getRecipebooksRecipes()
- 7.3 model/application/botcha.application.model.inc \BotchaModel::getRecipebooksRecipes()
3 calls to BotchaModel::getRecipebooksRecipes()
- Botcha::getRecipebook in controller/botcha.controller.inc
- Gets a recipe book from cache. If it does not exists in cache - gets from
database. If it does not exists there also - returns new recipe book or
BotchaRecipebookNone depending on input parameter.
- BotchaModel::getRecipesRecipebooks in model/botcha.model.inc
- BotchaRecipebookAbstract::getRecipes in controller/botcha_recipebook.controller.inc
- @todo BotchaRecipebook getRecipes Description.
File
- model/botcha.model.inc, line 73
Class
- BotchaModel
Code
public static function getRecipebooksRecipes($parameters = NULL) {
$fields = array();
switch ($parameters['mode']) {
case 'recipe':
$fields[] = 'recipe_id';
break;
case 'recipebook':
default:
$fields[] = 'rbid';
break;
}
$rbr = db_select('botcha_recipebook_recipe', 'brr')
->fields('brr', $fields);
if (!empty($parameters['recipebooks'])) {
$rbr
->condition('rbid', (array) $parameters['recipebooks'], 'IN');
}
if (!empty($parameters['recipes'])) {
$rbr
->condition('recipe_id', (array) $parameters['recipes'], 'IN');
}
try {
$result = $rbr
->execute()
->fetchCol();
} 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;
}