SharedShoppingCartRepository

Implements \SharedShoppingCartRepositoryInterface

Class SharedShoppingCartRepository

category

System

package

SharedShoppingCart

Methods

SharedShoppingCartRepository constructor.

__construct(\SharedShoppingCartReader $reader, \SharedShoppingCartWriter $writer, \SharedShoppingCartDeleter $deleter) 

Arguments

$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.

Deletes all shared shopping carts by a given customer ID.

deleteShoppingCartsByCustomerId(\IdType $customerId) 

Arguments

$customerId

\IdType

Deletes all shared shopping carts that are expired

deleteShoppingCartsOlderThan(\DateTime $expirationDate) 

Arguments

$expirationDate

\DateTime

All shared shopping carts older than that date are expired

Gets the content in JSON format of the shopping cart corresponding to the hash

getShoppingCart(\StringType $shoppingCartHash) : string

Arguments

$shoppingCartHash

\StringType

Hash of the shopping cart

Response

string

JSON representation of the shopping cart

Gets a collection of all shared shopping carts by a given customer ID.

getShoppingCartsByCustomerId(\IdType $customerId) : \SharedShoppingCartCollection

Arguments

$customerId

\IdType

Response

\SharedShoppingCartCollection

Stores the cart and returns the hash

storeShoppingCart(\StringType $jsonShoppingCart, \IdType|null $userId = null) : string
Throws
\InvalidArgumentException

Arguments

$jsonShoppingCart

\StringType

JSON representation of the cart

$userId

\IdType|null

The user ID of the user who is sharing the cart

Response

string

The hash of the cart

Properties

reader

reader : \SharedShoppingCartReader

writer

writer : \SharedShoppingCartWriter

deleter

deleter : \SharedShoppingCartDeleter