CategorySuggestItem
in package
FinalYes
Single category suggestion item. Plain data: it crosses the bridge as an array ({@see toArray()} / {@see fromArray()}) because `Result::data` must not carry an entity.
nameis the category name (the text put into the field after selection),pathholds the ancestor names from the root ("Cars › Passenger cars") and is the second line of the item.
Table of Contents
Properties
- $categoryId : int
- $level : int
- $name : string
- $path : string
Methods
- __construct() : mixed
- fromArray() : self|null
- toArray() : array{categoryId: int, name: string, path: string, level: int}
- toPickerArray() : array{id: int, label: string, name: string, meta: string}
- Returns the shape consumed by the `picker.js` client: `name` + `meta` (two-line item), `label` for screen readers and the legacy contract.
- str() : string
Properties
$categoryId read-only
public
int
$categoryId
$level read-only
public
int
$level
$name read-only
public
string
$name
$path read-only
public
string
$path
Methods
__construct()
public
__construct(int $categoryId, string $name, string $path, int $level) : mixed
Parameters
- $categoryId : int
- $name : string
- $path : string
- $level : int
fromArray()
public
static fromArray(array<string, mixed> $row) : self|null
Parameters
- $row : array<string, mixed>
Return values
self|nulltoArray()
public
toArray() : array{categoryId: int, name: string, path: string, level: int}
Return values
array{categoryId: int, name: string, path: string, level: int}toPickerArray()
Returns the shape consumed by the `picker.js` client: `name` + `meta` (two-line item), `label` for screen readers and the legacy contract.
public
toPickerArray() : array{id: int, label: string, name: string, meta: string}
Return values
array{id: int, label: string, name: string, meta: string}str()
private
static str(mixed $value) : string
Parameters
- $value : mixed