AdvertListTrait uses trait:short, trait:short, trait:short, trait:short
Table of Contents
Constants
- LIST_INCLUDES : mixed = ['parameterRels.parameter.translations', 'asset...
- List includes; identical for the DB path and the search endpoint.
Properties
- $categoryId : string|null
- $consentGateFactory : ConsentGateFactory
Methods
- actionList() : void
- createComponentConsentGate() : ConsentGate
- paginationInit() : Paginator|null
- prepareFilters() : array<int, Filter>
- renderList() : void
- requirePagination() : Paginator
- Works like `paginationInit()`, but the paginator is required; a missing component is a wiring error.
- prepareCanonicalUrl() : void
- prepareMetaDataForDetail() : void
- prepareMetaDataForList() : void
- prepareOgDataForDetail() : void
- prepareOgDataForList() : void
- prepareOrderBy() : array<string, bool>
- Builds the sorting of the three sortbox options (`Advert/list.latte`). They must match what is offered one to one, otherwise the user picks a sorting that does nothing:
- preparePerPage() : int
- prepareSearchFilters() : array<int, Filter>
- Builds the filters for the search endpoint: everything except the fulltext (the Api side handles it with ES or `MATCH_AGAINST`), i.e. visibility, category/region and the parameter filters from `$_GET['p']`, which are DB phase 1.
- prepareView() : void
-
searchViaApi()
: Advert>, 1: int, 2: bool, 3: array
>} |null - Searches through the Api endpoint `api/comcat/advert/search` instead of building the filter in the presenter. Three states:
Constants
LIST_INCLUDES
List includes; identical for the DB path and the search endpoint.
private
mixed
LIST_INCLUDES
= ['parameterRels.parameter.translations', 'assetRels.asset.translations', 'categoryRels.category.translations', 'user']
Properties
$categoryId
public
string|null
$categoryId
= null
Attributes
- #[Persistent]
$consentGateFactory
public
ConsentGateFactory
$consentGateFactory
Attributes
- #[Inject]
Methods
actionList()
public
actionList(int|null $page, string|int|null $category, string|int|null $loc, int|null $order) : void
Parameters
- $page : int|null
- $category : string|int|null
- $loc : string|int|null
- $order : int|null
createComponentConsentGate()
public
createComponentConsentGate() : ConsentGate
Return values
ConsentGatepaginationInit()
public
paginationInit(int $perPage) : Paginator|null
Parameters
- $perPage : int
Return values
Paginator|nullprepareFilters()
public
prepareFilters([bool $useParameterFilters = true ]) : array<int, Filter>
Parameters
- $useParameterFilters : bool = true
Return values
array<int, Filter>renderList()
public
renderList(int $page, string|int|null $category, string|int $loc, int $order[, int $count = 20 ]) : void
Parameters
- $page : int
- $category : string|int|null
- $loc : string|int
- $order : int
- $count : int = 20
requirePagination()
Works like `paginationInit()`, but the paginator is required; a missing component is a wiring error.
public
requirePagination(int $perPage) : Paginator
Parameters
- $perPage : int
Return values
PaginatorprepareCanonicalUrl()
private
prepareCanonicalUrl([array<string, mixed> $resetParams = [] ]) : void
Parameters
- $resetParams : array<string, mixed> = []
prepareMetaDataForDetail()
private
prepareMetaDataForDetail(Advert|null $entity, string $titlePrName, string $textPrName) : void
Parameters
- $entity : Advert|null
- $titlePrName : string
- $textPrName : string
prepareMetaDataForList()
private
prepareMetaDataForList([Category|null $category = null ]) : void
Parameters
- $category : Category|null = null
prepareOgDataForDetail()
private
prepareOgDataForDetail(Advert|null $entity, string $titlePrName, string $textPrName) : void
Parameters
- $entity : Advert|null
- $titlePrName : string
- $textPrName : string
prepareOgDataForList()
private
prepareOgDataForList([Category|null $category = null ]) : void
Parameters
- $category : Category|null = null
prepareOrderBy()
Builds the sorting of the three sortbox options (`Advert/list.latte`). They must match what is offered one to one, otherwise the user picks a sorting that does nothing:
private
prepareOrderBy() : array<string, bool>
/o-N1: newest,insertDatetime DESC/o-N2: most read,viewsDetail DESC/o-N3: best rated,ratingThread.ratingAvg DESC
IMPORTANT: every offered option needs its own case; one that falls into default sorts
like "newest" and the choice silently does nothing.
NOTE: ratingThread.ratingAvg is an association path (LEFT join through JoinHelper), so
a profile without a rating does not drop out of the list; it is only sorted by the empty value.
Return values
array<string, bool>preparePerPage()
private
preparePerPage(int $count[, int $defaultCount = 20 ]) : int
Parameters
- $count : int
- $defaultCount : int = 20
Return values
intprepareSearchFilters()
Builds the filters for the search endpoint: everything except the fulltext (the Api side handles it with ES or `MATCH_AGAINST`), i.e. visibility, category/region and the parameter filters from `$_GET['p']`, which are DB phase 1.
private
prepareSearchFilters() : array<int, Filter>
Return values
array<int, Filter>prepareView()
private
prepareView() : void
searchViaApi()
Searches through the Api endpoint `api/comcat/advert/search` instead of building the filter in the presenter. Three states:
private
searchViaApi(string $search, bool $orderChosen, Paginator|null $paginator) : Advert>, 1: int, 2: bool, 3: array>} |null
(a) search without a manual sorting choice: orderBys = null, ES sorts and paginates by
score (fromEs: true); visibility and parameter filters stay in the DB,
(b) search with a manual choice (/o-N in the URL): orderBys from prepareOrderBy(),
the DB sorts, paginates and counts over the ES id set and relevance is ignored,
(c) without a search the code never gets here and nothing changes.
NOTE: in state (a) the precedence of topped profiles does not apply. prepareOrderBy()
normally puts topedUntil > NOW() first, but on the relevance path ES sorts by score and
the DB has no say in the order.
null means use the DB path: the endpoint returned no list (deny or bridge outage), or ES
is down and without a manual choice the DB branch of the endpoint would return unsorted rows.
Parameters
- $search : string
- $orderChosen : bool
- $paginator : Paginator|null