CategorySuggestTrait
Internal `suggest` action of the Api `CategoryPresenter` of a module (Bazaar, Comcat): the category autocomplete of the watchdog. Read-only over the public category tree (name and path), no personal data.
IMPORTANT: deliberately without action*(), so it is reachable only through an internal
bridge call; otherwise it would become an external endpoint. Guarded by
FrontApiSurfacePolicyTest.
Rate limit per IP (ratelimit.categorySuggest, switch security.rateLimit), the key shared by
both modules. Over the limit it returns limited: true and no items (the front signal
answers 429).
Requires in the presenter:
$this->rateLimit(RateLimit),$this->rateLimitConfig(RateLimitConfig)suggestCategories(CategorySuggestQuery): list<CategorySuggestItem>calling the module manager
Table of Contents
Methods
-
internalActionSuggest()
: array{items: list
>, limited: bool}|ApiPermissionDeniedShape - suggestCategories() : array<int, CategorySuggestItem>
Methods
internalActionSuggest()
public
internalActionSuggest([string $q = '' ][, int $languageId = 0 ][, int $limit = CategorySuggestQuery::DEFAULT_LIMIT ]) : array{items: list>, limited: bool}|ApiPermissionDeniedShape
Parameters
- $q : string = ''
- $languageId : int = 0
- $limit : int = CategorySuggestQuery::DEFAULT_LIMIT
Return values
array{items: listsuggestCategories()
protected
abstract suggestCategories(CategorySuggestQuery $query) : array<int, CategorySuggestItem>
Parameters
- $query : CategorySuggestQuery