CategorySuggestQuery
in package
FinalYes
Category suggestion query.
Input normalization lives here and nowhere else: the front end calls it before the bridge and
the Api presenter calls it again, because input arriving over the bridge is not trusted.
Diacritics are not stripped: category name uses the utf8_general_ci collation, which
compares accented and unaccented letters and letter case as equal.
Table of Contents
Constants
- DEFAULT_LIMIT : int = 10
- LIKE_ESCAPE : string = '!'
- Escape character for `LIKE … ESCAPE '!'`; independent of `NO_BACKSLASH_ESCAPES`.
- MAX_LENGTH : int = 100
- MAX_LIMIT : int = 20
- MIN_LENGTH : int = 2
Properties
- $languageId : int
- $limit : int
- $text : string
Methods
- fromInput() : self
- isEmpty() : bool
- Returns whether there is nothing to search for (short input); the query never reaches the database.
- likeText() : string
- Escapes the text for `LIKE … ESCAPE '!'` so that `%` and `_` stay ordinary characters.
- __construct() : mixed
Constants
DEFAULT_LIMIT
public
int
DEFAULT_LIMIT
= 10
LIKE_ESCAPE
Escape character for `LIKE … ESCAPE '!'`; independent of `NO_BACKSLASH_ESCAPES`.
public
string
LIKE_ESCAPE
= '!'
MAX_LENGTH
public
int
MAX_LENGTH
= 100
MAX_LIMIT
public
int
MAX_LIMIT
= 20
MIN_LENGTH
public
int
MIN_LENGTH
= 2
Properties
$languageId read-only
public
int
$languageId
$limit read-only
public
int
$limit
$text read-only
public
string
$text
Methods
fromInput()
public
static fromInput(string $raw, int $languageId[, int $limit = self::DEFAULT_LIMIT ]) : self
Parameters
- $raw : string
- $languageId : int
- $limit : int = self::DEFAULT_LIMIT
Return values
selfisEmpty()
Returns whether there is nothing to search for (short input); the query never reaches the database.
public
isEmpty() : bool
Return values
boollikeText()
Escapes the text for `LIKE … ESCAPE '!'` so that `%` and `_` stay ordinary characters.
public
likeText() : string
Return values
string__construct()
private
__construct(string $text, int $languageId, int $limit) : mixed
Parameters
- $text : string
- $languageId : int
- $limit : int