public static function SuggestionStorage::getNgramQty in Autocomplete Search Suggestions 8.2
Same name and namespace in other branches
- 8 src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getNgramQty()
- 3.0.x src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getNgramQty()
Fetch the quantity for the supplied ngram.
Parameters
string $ngram: The ngram value.
string $langcode: The language code.
Return value
int The qty value for the supplied ngram.
2 calls to SuggestionStorage::getNgramQty()
- SuggestionHelper::insert in src/
SuggestionHelper.php - Add a suggestion.
- suggestion_surfer_submit in ./
suggestion.module - Custom submit function to add surfer suggestions.
File
- src/
SuggestionStorage.php, line 161
Class
- SuggestionStorage
- Database CRUD.
Namespace
Drupal\suggestionCode
public static function getNgramQty($ngram = '', $langcode = '') {
return \Drupal::database()
->query("SELECT IFNULL(SUM(qty), 0) FROM {suggestion} WHERE ngram = :ngram AND langcode IN (:langcodes[])", [
':ngram' => $ngram,
':langcodes[]' => SuggestionHelper::getLancodes($langcode),
])
->fetchField();
}