SharedShoppingCartRepository
in package
implements
SharedShoppingCartRepositoryInterface
Class SharedShoppingCartRepository
Tags
Interfaces, Classes and Traits
- SharedShoppingCartRepositoryInterface
- Interface SharedShoppingCartRepositoryInterface
Table of Contents
- $deleter : SharedShoppingCartDeleter
- $reader : SharedShoppingCartReader
- $writer : SharedShoppingCartWriter
- __construct() : mixed
- SharedShoppingCartRepository constructor.
- deleteShoppingCartsByCustomerId() : mixed
- Deletes all shared shopping carts by a given customer ID.
- deleteShoppingCartsOlderThan() : mixed
- Deletes all shared shopping carts that are expired
- getShoppingCart() : string
- Gets the content in JSON format of the shopping cart corresponding to the hash
- getShoppingCartsByCustomerId() : SharedShoppingCartCollection
- Gets a collection of all shared shopping carts by a given customer ID.
- storeShoppingCart() : string
- Stores the cart and returns the hash
Properties
$deleter
protected
SharedShoppingCartDeleter
$deleter
$reader
protected
SharedShoppingCartReader
$reader
$writer
protected
SharedShoppingCartWriter
$writer
Methods
__construct()
SharedShoppingCartRepository constructor.
public
__construct(SharedShoppingCartReader $reader, SharedShoppingCartWriter $writer, SharedShoppingCartDeleter $deleter) : mixed
Parameters
- $reader : SharedShoppingCartReader
-
Instance to fetch shared shopping cart data.
- $writer : SharedShoppingCartWriter
-
Instance to insert and update shared shopping cart data.
- $deleter : SharedShoppingCartDeleter
-
Instance to remove shared shopping cart data.
Return values
mixed —deleteShoppingCartsByCustomerId()
Deletes all shared shopping carts by a given customer ID.
public
deleteShoppingCartsByCustomerId(IdType $customerId) : mixed
Parameters
- $customerId : IdType
Return values
mixed —deleteShoppingCartsOlderThan()
Deletes all shared shopping carts that are expired
public
deleteShoppingCartsOlderThan(DateTime $expirationDate) : mixed
Parameters
- $expirationDate : DateTime
-
All shared shopping carts older than that date are expired
Return values
mixed —getShoppingCart()
Gets the content in JSON format of the shopping cart corresponding to the hash
public
getShoppingCart(StringType $shoppingCartHash) : string
Parameters
- $shoppingCartHash : StringType
-
Hash of the shopping cart
Return values
string —JSON representation of the shopping cart
getShoppingCartsByCustomerId()
Gets a collection of all shared shopping carts by a given customer ID.
public
getShoppingCartsByCustomerId(IdType $customerId) : SharedShoppingCartCollection
Parameters
- $customerId : IdType
Return values
SharedShoppingCartCollection —storeShoppingCart()
Stores the cart and returns the hash
public
storeShoppingCart(StringType $jsonShoppingCart[, IdType|null $userId = null ]) : string
Parameters
- $jsonShoppingCart : StringType
-
JSON representation of the cart
- $userId : IdType|null = null
-
The user ID of the user who is sharing the cart
Tags
Return values
string —The hash of the cart