TermHelper
in package
Lightweight term lookup helper — replaces QubitTerm::getById() for read-only access.
Uses Laravel Query Builder with per-request caching. Does NOT replace Propel for write operations (save, setName, etc.).
Table of Contents
Methods
- clearCache() : void
- Clear the per-request cache. Useful in long-running CLI tasks.
- exists() : bool
- Check if a term exists by ID.
- name() : string
- Get the localized name of a term by ID.
Methods
clearCache()
Clear the per-request cache. Useful in long-running CLI tasks.
public
static clearCache() : void
exists()
Check if a term exists by ID.
public
static exists(int|string|null $id) : bool
Replaces: null === QubitTerm::getById($id) → !term_exists($id)
Parameters
- $id : int|string|null
-
Term ID
Return values
boolname()
Get the localized name of a term by ID.
public
static name(int|string|null $id[, string|null $culture = null ]) : string
Replaces: QubitTerm::getById($id)->getName(['culture' => $culture]) Replaces: QubitTerm::getById($id)->__toString() (in string concatenation) Replaces: QubitTerm::getById($id)->name
Parameters
- $id : int|string|null
-
Term ID
- $culture : string|null = null
-
ISO culture code (e.g. 'en', 'af'). Null = current user culture.
Return values
string —Term name, or empty string if not found