CoolCMS API

ProductSetMapper extends ApiMapper
in package

FinalYes

Front mapper that hydrates Api repository data into entities.

Tags
extends

Table of Contents

Properties

$hydrator  : EntityHydrator
$repository  : ProductSetRepository

Methods

__construct()  : mixed
fetchAvailability()  : array<int, array{availableSets: ?int, inStock: bool, deliveryDays: ?int, labelWarehouseId: ?int, infoText: ?string, attributeClass: ?string, unmappedVariantIds: list, unresolvedSetIds: list}>
fetchCurrentPrices()  : array<int, array{price: string, originalPrice: string, points: int, fromAmount: int, currencyId: int, vat: string, withVat: bool}>
fetchGifts()  : array<int, array{name: string, amount: int}>
See {@see ProductSetRepository::fetchGifts()}.
fetchNextPriceTimes()  : array<int, string>
Returns the end of the deal for the countdown, in a batch; see {@see ProductSetRepository::fetchNextPriceTimes()}.
fetchParameterValueCounts()  : array<int, array<string|int, int>>
Returns set counts by parameter value; see {@see \App\UI\Api\Eshop\Models\Managers\ProductSetManager::fetchParameterValueCounts()}.
fetchPriceDisplay()  : array{paymentRegionId: int, chargeVat: bool, noteKey: ?string}
Returns the catalog display treatment; see {@see ProductSetRepository::fetchPriceDisplay()}.
find()  : T|null
findAll()  : T>, 1: int}
findBy()  : T|null
registerView()  : void
search()  : ProductSet>, 1: int, 2: bool, 3: array>}|null
Maps the response of the Api endpoint `search`.
getEntityClass()  : T>
initalizeEntity()  : ProductSet|null
highlights()  : array<int, array<string, string>>
Returns the snippets from the endpoint: `card id => field => HTML`.

Properties

Methods

fetchAvailability()

public fetchAvailability(array<string|int, int> $ids[, int|null $languageId = null ]) : array<int, array{availableSets: ?int, inStock: bool, deliveryDays: ?int, labelWarehouseId: ?int, infoText: ?string, attributeClass: ?string, unmappedVariantIds: list, unresolvedSetIds: list}>
Parameters
$ids : array<string|int, int>
$languageId : int|null = null
Return values
array<int, array{availableSets: ?int, inStock: bool, deliveryDays: ?int, labelWarehouseId: ?int, infoText: ?string, attributeClass: ?string, unmappedVariantIds: list, unresolvedSetIds: list}>

fetchCurrentPrices()

public fetchCurrentPrices(array<string|int, int> $ids[, int|null $userGroupId = null ][, int|null $currencyId = null ][, int $amount = 1 ][, int|null $paymentRegionId = null ]) : array<int, array{price: string, originalPrice: string, points: int, fromAmount: int, currencyId: int, vat: string, withVat: bool}>
Parameters
$ids : array<string|int, int>
$userGroupId : int|null = null
$currencyId : int|null = null
$amount : int = 1
$paymentRegionId : int|null = null
Return values
array<int, array{price: string, originalPrice: string, points: int, fromAmount: int, currencyId: int, vat: string, withVat: bool}>

fetchGifts()

See {@see ProductSetRepository::fetchGifts()}.

public fetchGifts(int $setId[, int|null $languageId = null ]) : array<int, array{name: string, amount: int}>
Parameters
$setId : int
$languageId : int|null = null
Return values
array<int, array{name: string, amount: int}>

fetchNextPriceTimes()

Returns the end of the deal for the countdown, in a batch; see {@see ProductSetRepository::fetchNextPriceTimes()}.

public fetchNextPriceTimes(array<string|int, int> $ids[, int|null $currencyId = null ]) : array<int, string>
Parameters
$ids : array<string|int, int>
$currencyId : int|null = null
Return values
array<int, string> —

setId => nearest future published_time

fetchParameterValueCounts()

Returns set counts by parameter value; see {@see \App\UI\Api\Eshop\Models\Managers\ProductSetManager::fetchParameterValueCounts()}.

public fetchParameterValueCounts(array<int, object> $filters) : array<int, array<string|int, int>>
Parameters
$filters : array<int, object>
Return values
array<int, array<string|int, int>> —

parameterId => [value => count]

fetchPriceDisplay()

Returns the catalog display treatment; see {@see ProductSetRepository::fetchPriceDisplay()}.

public fetchPriceDisplay([int|null $paymentRegionId = null ]) : array{paymentRegionId: int, chargeVat: bool, noteKey: ?string}
Parameters
$paymentRegionId : int|null = null
Return values
array{paymentRegionId: int, chargeVat: bool, noteKey: ?string}

find()

public find(int $pageId[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$pageId : int
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

findAll()

public findAll([array<string|int, mixed>|null $filters = [] ][, array<string|int, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T>, 1: int}
Parameters
$filters : array<string|int, mixed>|null = []
$orderBys : array<string|int, mixed>|null = null
$offset : int|null = null
$limit : int|null = null
$columns : array<string|int, mixed>|null = null
$computeTotalCount : bool = false
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T>, 1: int}

findBy()

public findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$filters : array<string|int, mixed>|null = []
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

registerView()

public registerView(int $id) : void
Parameters
$id : int

Maps the response of the Api endpoint `search`.

public search(string $search, string|null $languageAlias[, array<int, object|array<string, mixed>> $filters = [] ][, array<string, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, string|array<int, string> $includes = [] ]) : ProductSet>, 1: int, 2: bool, 3: array>}|null

Hydration runs in payload order (EntityHydrator::hydrateAll() iterates items as they came), so the Elasticsearch relevance passes to the front end naturally; the endpoint already reordered the items on the Api side (SearchTrait::orderItemsByIds).

Parameters
$search : string
$languageAlias : string|null
$filters : array<int, object|array<string, mixed>> = []
$orderBys : array<string, mixed>|null = null
$offset : int|null = null
$limit : int|null = null
$includes : string|array<int, string> = []
Return values
ProductSet>, 1: int, 2: bool, 3: array>}|null —

[entities, totalCount, fromEs, highlights]; null = the response is not a list (DENY envelope / bridge outage); the caller must fall back to the plain DB path, not render an empty result

highlights()

Returns the snippets from the endpoint: `card id => field => HTML`.

private static highlights(array<string, mixed> $payload) : array<int, array<string, string>>

Values are already escaped and may contain only <em> (converted by EsHighlighter on the Api side); only the shape is verified here, so nothing the endpoint did not give reaches the template (where it goes through |noescape).

Parameters
$payload : array<string, mixed>
Return values
array<int, array<string, string>>
On this page

Search results