'obj.user_id', 'type' => '=', 'value' => CURRENT_USER->get_id() ] )); $fav_ids = array_map(function($recipe) { return $recipe->field_recipe_id; }, $favorite_recipes); if(!empty($fav_ids)) { $context['recipes'] = RecipeModel::filter( array( [ 'name' => 'obj.id', 'type' => 'IN', 'value' => $fav_ids ] ), ['-obj.created_at'], FAVORITES_MAX_RECIPES ); } else { $context['recipes'] = []; } return $context; } }