CoolCMS API

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

LIKE_ESCAPE

Escape character for `LIKE … ESCAPE '!'`; independent of `NO_BACKSLASH_ESCAPES`.

public string LIKE_ESCAPE = '!'

Properties

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
self

isEmpty()

Returns whether there is nothing to search for (short input); the query never reaches the database.

public isEmpty() : bool
Return values
bool

likeText()

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
On this page

Search results