WorkItemMapper
extends ApiMapper
in package
Front mapper that hydrates Api repository data into entities.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- addMyComment() : array{success: bool, code: int|null, message: string|null, commentId: int|null, approved: bool, retryAfter?: int}
- Adds a customer comment to the thread of the customer's own work item.
- find() : T|null
- findAll() : T>, 1: int}
- findBy() : T|null
- findMyComments() : WorkItemComment>, totalCount: int}
- Returns the comments of a work item for its customer.
- findMyDetail() : WorkItem|null
- Returns a work item detail for its customer.
-
findMyItems()
: WorkSheet>, unreadComments: array
} - Returns the work items of one of the customer's work sheets.
- getEntityClass() : T>
- initalizeEntity() : WorkItem|null
Properties
$hydrator read-only
protected
EntityHydrator
$hydrator
$repository read-only
protected
WorkItemRepository
$repository
Methods
__construct()
public
__construct(WorkItemRepository $repository, EntityHydrator $hydrator) : mixed
Parameters
- $repository : WorkItemRepository
- $hydrator : EntityHydrator
addMyComment()
Adds a customer comment to the thread of the customer's own work item.
public
addMyComment(int $workItemId, string $text) : array{success: bool, code: int|null, message: string|null, commentId: int|null, approved: bool, retryAfter?: int}
Passes the call through to WorkItemRepository::addMyComment(). The response is not an entity; the Result envelope is propagated unchanged, same as ReservationMapper::book().
Parameters
- $workItemId : int
- $text : string
Return values
array{success: bool, code: int|null, message: string|null, commentId: int|null, approved: bool, retryAfter?: int}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|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|nullfindMyComments()
Returns the comments of a work item for its customer.
public
findMyComments(int $workItemId[, int|null $offset = null ][, int|null $limit = null ]) : WorkItemComment>, totalCount: int}
Bridge to the narrow Api action myComments
(WorkItemPresenter::internalActionMyComments()).
IMPORTANT: comments live in their own table (cms_mod_company_work_item_comments) and the Api serializes WorkItemComment, so they are hydrated into the Front WorkItemComment, not into the Base Comment (the old thread model). The threadId key no longer exists in the response. The author is getAuthorName().
Parameters
- $workItemId : int
- $offset : int|null = null
- $limit : int|null = null
Return values
WorkItemComment>, totalCount: int}findMyDetail()
Returns a work item detail for its customer.
public
findMyDetail(int $workItemId) : WorkItem|null
Bridge to the narrow Api action myDetail
(WorkItemPresenter::internalActionMyDetail()).
Someone else's, missing or deleted work returns null; the component builds one uniform empty state from it.
Parameters
- $workItemId : int
Return values
WorkItem|nullfindMyItems()
Returns the work items of one of the customer's work sheets.
public
findMyItems(int $workListId[, int|null $offset = null ][, int|null $limit = null ]) : WorkSheet>, unreadComments: array}
Bridge to the narrow Api action myItems
(WorkItemPresenter::internalActionMyItems()).
The response has the standard {items, totalCount, _references} shape, but totalCount is always null (the list is always complete), so only the list is returned.
IMPORTANT: _references carries WorkSheet next to WorkItem (grouping by sheet, see WorkItemPresenter::withSheetReferences()). hydrateAll() returns only items of the main class; the side entity must be fetched with EntityHydrator::getCached() over the same payload right after hydration.
Parameters
- $workListId : int
- $offset : int|null = null
- $limit : int|null = null
Return values
WorkSheet>, unreadComments: arraygetEntityClass()
protected
getEntityClass() : T>
Return values
T>initalizeEntity()
protected
initalizeEntity(array<string, mixed> $row) : WorkItem|null
Parameters
- $row : array<string, mixed>