AdvertMapper
extends ApiMapper
in package
uses
AdvertConfirmByKeyTrait, SaveTrait, RegisterEventTrait, AdvertExpirationTrait, AdvertPasswordResetTrait
Front mapper that hydrates Api repository data into entities.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- extendExpiration() : Result
- find() : T|null
- findAll() : T>, 1: int}
- findBy() : T|null
- redeemManageKey() : Result
- Redeems the key from the advert management link in the insertion email (advert without an account).
- registerEvent() : Result
- resetPassword() : Result
- save() : Result
-
search()
: Advert>, 1: int, 2: bool, 3: array
>} |null - Searches through the Api endpoint `search`. Hydration follows the payload order ({@see EntityHydrator::hydrateAll()} iterates `items` as they came), so the ES relevance reaches the front end as is; the endpoint already reordered the items on the Api side (`SearchTrait::orderItemsByIds`).
- sendPasswordReset() : Result
- updateColumns() : Result
- getEntityClass() : T>
- initalizeEntity() : Advert|null
- highlights() : array<int, array<string, string>>
- Extracts the endpoint highlights: `profile id => field => HTML`. Values are already escaped and may contain only `<em>` (converted by {@see \App\Core\Integrations\Elasticsearch\Search\EsHighlighter} on the Api side); only the shape is verified here, so nothing the endpoint did not return reaches the template, where the values are printed with `|noescape`.
Properties
$hydrator read-only
protected
EntityHydrator
$hydrator
$repository read-only
protected
AdvertRepository
$repository
Methods
__construct()
public
__construct(AdvertRepository $repository, EntityHydrator $hydrator) : mixed
Parameters
- $repository : AdvertRepository
- $hydrator : EntityHydrator
extendExpiration()
public
extendExpiration(int $advertId) : Result
Parameters
- $advertId : int
Return values
Resultfind()
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|nullfindAll()
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|nullredeemManageKey()
Redeems the key from the advert management link in the insertion email (advert without an account).
public
redeemManageKey(int $advertId, string $key) : Result
Parameters
- $advertId : int
- $key : string
Return values
ResultregisterEvent()
public
registerEvent(array<string|int, int> $ids, string $property) : Result
Parameters
- $ids : array<string|int, int>
- $property : string
Return values
ResultresetPassword()
public
resetPassword(int $advertId, string $key, string $password) : Result
Parameters
- $advertId : int
- $key : string
- $password : string
Return values
Resultsave()
public
save(BaseEntity $entity[, array<string, mixed> $meta = [] ][, array<int, string> $skipFields = [] ]) : Result
Parameters
- $entity : BaseEntity
- $meta : array<string, mixed> = []
- $skipFields : array<int, string> = []
Return values
Resultsearch()
Searches through the Api endpoint `search`. Hydration follows the payload order ({@see EntityHydrator::hydrateAll()} iterates `items` as they came), so the ES relevance reaches the front end as is; the endpoint already reordered the items on the Api side (`SearchTrait::orderItemsByIds`).
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 = [] ]) : Advert>, 1: int, 2: bool, 3: array>} |null
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
Advert>, 1: int, 2: bool, 3: array[entities, totalCount, fromEs, highlights]; null = the response is not a list
(deny envelope or bridge outage); the caller must fall back to the DB path, not
render an empty list
sendPasswordReset()
public
sendPasswordReset(int $advertId, string $email) : Result
Parameters
- $advertId : int
- $email : string
Return values
ResultupdateColumns()
public
updateColumns(array<string|int, mixed> $ids, array<string, mixed> $values) : Result
Parameters
- $ids : array<string|int, mixed>
-
ids or composite-id arrays
- $values : array<string, mixed>
-
property name => new value
Return values
ResultgetEntityClass()
protected
getEntityClass() : T>
Return values
T>initalizeEntity()
protected
initalizeEntity(array<string, mixed> $row) : Advert|null
Parameters
- $row : array<string, mixed>
Return values
Advert|nullhighlights()
Extracts the endpoint highlights: `profile id => field => HTML`. Values are already escaped and may contain only `<em>` (converted by {@see \App\Core\Integrations\Elasticsearch\Search\EsHighlighter} on the Api side); only the shape is verified here, so nothing the endpoint did not return reaches the template, where the values are printed with `|noescape`.
private
static highlights(array<string, mixed> $payload) : array<int, array<string, string>>
Parameters
- $payload : array<string, mixed>