CartMapper
in package
implements
CartMapperInterface
FinalYes
DB variant of the cart mapper.
Translates the wire shape of api/eshop/cart/load / /save
({items: list<{setId,quantity}>, vouchers: list<string>, checkout: array}) to and from
CartSnapshot (items as a setId => quantity dict).
Table of Contents
Interfaces
- CartMapperInterface
- Translates between the raw storage (session section or Api wire payload) and {@see CartSnapshot}.
Properties
Methods
- __construct() : mixed
- load() : CartSnapshot
- save() : void
- toSnapshot() : CartSnapshot
Properties
$repository read-only
private
CartRepository
$repository
Methods
__construct()
public
__construct(CartRepository $repository) : mixed
Parameters
- $repository : CartRepository
load()
public
load(int|null $userId) : CartSnapshot
Parameters
- $userId : int|null
Return values
CartSnapshotsave()
public
save(int|null $userId, CartSnapshot $snapshot) : void
Parameters
- $userId : int|null
- $snapshot : CartSnapshot
toSnapshot()
private
toSnapshot(array<string, mixed> $raw) : CartSnapshot
Parameters
- $raw : array<string, mixed>