RegionSuggestQuery
in package
Query of the municipality/postcode suggester.
Input normalization lives here and only here: Front calls it before the bridge, Admin and Api presenters call it again (bridge input is not trusted), so all paths trim the same way. Values are plain data (scalars) sent over the bridge one by one.
name= diacritics-free form of the text (single spaces), forname_ascii like;postcode= digits only, when the input contains only digits after removing spaces (at least 3); the postcode branch is searched then andnameis empty.
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_NAME_LENGTH : int = 2
- MIN_POSTCODE_LENGTH : int = 3
Properties
- $languageId : int
- $leafOnly : bool
- $limit : int
- $minLevel : int
- $name : string
- $postcode : string|null
- $preferRegionId : int|null
Methods
- escapeLike() : string
- Escapes user input for `like ... escape '!'`. `%` and `_` are ordinary characters for the user and must not become wildcards ("%" would return everything).
- fromInput() : self
- isEmpty() : bool
- Returns whether there is nothing to search for (short input, punctuation only); no query is sent to the database.
- normalizeInputLength() : string
- Trims and cuts free text to the max length (no diacritics removal, it goes to the external geocoder).
- normalizeText() : string
- Trims, cuts to the max length, removes diacritics and unifies spaces.
- __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_NAME_LENGTH
public
int
MIN_NAME_LENGTH
= 2
MIN_POSTCODE_LENGTH
public
int
MIN_POSTCODE_LENGTH
= 3
Properties
$languageId read-only
public
int
$languageId
$leafOnly read-only
public
bool
$leafOnly
$limit read-only
public
int
$limit
$minLevel read-only
public
int
$minLevel
$name read-only
public
string
$name
$postcode read-only
public
string|null
$postcode
$preferRegionId read-only
public
int|null
$preferRegionId
Methods
escapeLike()
Escapes user input for `like ... escape '!'`. `%` and `_` are ordinary characters for the user and must not become wildcards ("%" would return everything).
public
static escapeLike(string $value) : string
Parameters
- $value : string
Return values
stringfromInput()
public
static fromInput(string $raw, int $languageId[, int|null $preferRegionId = null ][, int $minLevel = 2 ][, bool $leafOnly = false ][, int $limit = self::DEFAULT_LIMIT ]) : self
Parameters
- $raw : string
-
user input (any length, diacritics, spaces)
- $languageId : int
- $preferRegionId : int|null = null
-
country (level 1) whose items take precedence, from the website localization
- $minLevel : int = 2
-
lowest tree level (1 = country included, 2 = from region)
- $leafOnly : bool = false
-
only tree leaves of type municipality (advert form)
- $limit : int = self::DEFAULT_LIMIT
Return values
selfisEmpty()
Returns whether there is nothing to search for (short input, punctuation only); no query is sent to the database.
public
isEmpty() : bool
Return values
boolnormalizeInputLength()
Trims and cuts free text to the max length (no diacritics removal, it goes to the external geocoder).
public
static normalizeInputLength(string $raw) : string
Parameters
- $raw : string
Return values
stringnormalizeText()
Trims, cuts to the max length, removes diacritics and unifies spaces.
public
static normalizeText(string $raw) : string
Parameters
- $raw : string
Return values
string__construct()
private
__construct(string $name, string|null $postcode, int $languageId, int|null $preferRegionId, int $minLevel, bool $leafOnly, int $limit) : mixed
Parameters
- $name : string
- $postcode : string|null
- $languageId : int
- $preferRegionId : int|null
- $minLevel : int
- $leafOnly : bool
- $limit : int