ComplaintRepository
extends ApiRepository
in package
Bridge to the complaint orchestration actions (`api/eshop/complaint/submit`, `/my-prefill`, `/my-complaints`, `/my-complaint`).
Same pattern as CheckoutRepository: the actions return ready scalar data (no entity to hydrate), so ComplaintMapper is a thin passthrough.
userId is never sent: all four Api actions read it from the server-side JWT (bridge
resolveInternalAuthToken()), and the front end could not send it trustworthily anyway.
The bridge sends scalars only, so items / files go as a JSON string, not a PHP array.
Table of Contents
Properties
- $apiEndpoint : string
- Api presenter path (e.g. `api/system/page`); set by each concrete repository.
- $bridge : ApiBridge
Methods
- __construct() : mixed
- detail() : array<string, mixed>
- fileData() : array<string, mixed>
- Returns the relative path to an attachment of the user's own complaint (`api/eshop/complaint/my-complaint-file`, {@see \App\UI\Api\Eshop\Presenters\ComplaintPresenter::internalActionMyComplaintFile()}).
- find() : array<string|int, mixed>
- findAll() : array<string|int, mixed>
- findBy() : array<string|int, mixed>
- list() : array<string, mixed>
- prefill() : array<string, mixed>
- submit() : array<string, mixed>
- failSoftRead() : array<string|int, mixed>
- Normalizes a bridge response to plain data; a failed envelope or a non-array gives `[]`.
- getApiCallSource() : string
- Branch marker for writes ({@see ApiBridge::PARAM_SOURCE}), read by the shared repository `SaveTrait`.
Properties
$apiEndpoint
Api presenter path (e.g. `api/system/page`); set by each concrete repository.
protected
string
$apiEndpoint
= 'api/eshop/complaint'
$bridge read-only
protected
ApiBridge
$bridge
Methods
__construct()
public
__construct(ApiBridge $bridge) : mixed
Parameters
- $bridge : ApiBridge
detail()
public
detail(int $id) : array<string, mixed>
Parameters
- $id : int
Return values
array<string, mixed>fileData()
Returns the relative path to an attachment of the user's own complaint (`api/eshop/complaint/my-complaint-file`, {@see \App\UI\Api\Eshop\Presenters\ComplaintPresenter::internalActionMyComplaintFile()}).
public
fileData(int $complaintId, int $position) : array<string, mixed>
Parameters
- $complaintId : int
- $position : int
Return values
array<string, mixed>find()
public
find(int $id[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>
Parameters
- $id : int
- $includes : string|array<string|int, mixed> = []
- $useCache : bool|null = null
Return values
array<string|int, mixed>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 ]) : array<string|int, mixed>
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
array<string|int, mixed>findBy()
public
findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed>|null = []
- $includes : string|array<string|int, mixed> = []
- $useCache : bool|null = null
Return values
array<string|int, mixed>list()
public
list(int $limit, int $offset) : array<string, mixed>
Parameters
- $limit : int
- $offset : int
Return values
array<string, mixed>prefill()
public
prefill(int $orderId) : array<string, mixed>
Parameters
- $orderId : int
Return values
array<string, mixed>submit()
public
submit(int $orderId, array<int, array{orderItemId: int, quantity: int}> $items, int|null $preferredSolutionId, string $description, array<int, array{name: string, path: string}> $files) : array<string, mixed>
Parameters
- $orderId : int
- $items : array<int, array{orderItemId: int, quantity: int}>
- $preferredSolutionId : int|null
- $description : string
- $files : array<int, array{name: string, path: string}>
Return values
array<string, mixed>failSoftRead()
Normalizes a bridge response to plain data; a failed envelope or a non-array gives `[]`.
protected
failSoftRead(mixed $response, string $endpoint) : array<string|int, mixed>
NOTE: it does not log on purpose. ApiBridge::call(), which sees both the
endpoint and the caller, has already written the API_FAILSOFT source=bridge line; a second
copy would turn one failure into three lines in auth.log.
Parameters
- $response : mixed
- $endpoint : string
-
only for call readability; the log takes the endpoint from the bridge
Return values
array<string|int, mixed>getApiCallSource()
Branch marker for writes ({@see ApiBridge::PARAM_SOURCE}), read by the shared repository `SaveTrait`.
protected
getApiCallSource() : string