CoolCMS API

RatingMapper extends ApiMapper
in package
uses SaveTrait

FinalYes

Front mapper that hydrates Api repository data into entities.

Tags
extends

Table of Contents

Properties

$hydrator  : EntityHydrator
$repository  : RatingRepository

Methods

__construct()  : mixed
canRespondTo()  : bool
Pass-through to the repository. `$repository` is a concrete type with the guaranteed method here (no `method_exists` guard).
find()  : T|null
findAll()  : T>, 1: int}
findBy()  : T|null
myVotes()  : array<int, bool>
Pass-through to the repository. How the visitor voted on the displayed ratings (batch for the whole page).
report()  : Result
Reports an inappropriate review.
save()  : Result
saveReply()  : Result
Pass-through to the repository. The rating reply goes through the dedicated Api action `saveReply`, not the generic `save` (own key, own ownership check).
updateColumns()  : Result
vote()  : Result
Pass-through to the repository. Vote on the helpfulness of a rating.
getEntityClass()  : T>
initalizeEntity()  : Rating|null

Properties

Methods

canRespondTo()

Pass-through to the repository. `$repository` is a concrete type with the guaranteed method here (no `method_exists` guard).

public canRespondTo(int $ratingId, int $userId) : bool
Parameters
$ratingId : int
$userId : int
Return values
bool

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

myVotes()

Pass-through to the repository. How the visitor voted on the displayed ratings (batch for the whole page).

public myVotes(array<int, int> $ratingIds, int|null $userId, string $ip) : array<int, bool>
Parameters
$ratingIds : array<int, int>
$userId : int|null
$ip : string
Return values
array<int, bool>

report()

Reports an inappropriate review.

public report(int $ratingId, int|null $userId, string $ip) : Result
Parameters
$ratingId : int
$userId : int|null
$ip : string
Return values
Result

save()

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
Result

saveReply()

Pass-through to the repository. The rating reply goes through the dedicated Api action `saveReply`, not the generic `save` (own key, own ownership check).

public saveReply(int $ratingId, string|null $response) : Result
Parameters
$ratingId : int
$response : string|null
Return values
Result

updateColumns()

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
Result

vote()

Pass-through to the repository. Vote on the helpfulness of a rating.

public vote(int $ratingId, bool $up, int|null $userId, string $ip) : Result
Parameters
$ratingId : int
$up : bool
$userId : int|null
$ip : string
Return values
Result

getEntityClass()

protected getEntityClass() : T>
Return values
T>

initalizeEntity()

protected initalizeEntity(array<string, mixed> $row) : Rating|null
Parameters
$row : array<string, mixed>
Return values
Rating|null
On this page

Search results