ProductRepository

Implements \ProductRepositoryInterface

Class ProductRepository

category

System

package

Product

subpackage

Repositories

Methods

Initialize the product repository.

__construct(\ProductRepositoryReaderInterface $reader, \ProductRepositoryWriterInterface $writer, \ProductRepositoryDeleterInterface $deleter, \ProductSettingsRepositoryInterface $settingsRepo, \AddonValueServiceInterface $addonValueService, \ProductImageContainerRepositoryInterface $imageContainerRepo, \UrlRewriteStorage $urlRewriteStorage) 

Arguments

$reader

\ProductRepositoryReaderInterface

Instance to perform db read actions.

$writer

\ProductRepositoryWriterInterface

Instance to perform db write actions.

$deleter

\ProductRepositoryDeleterInterface

Instance to perform db delete actions.

$settingsRepo

\ProductSettingsRepositoryInterface

Repository instance to read/write/delete product settings.

$addonValueService

\AddonValueServiceInterface

Service to handle product addon values.

$imageContainerRepo

\ProductImageContainerRepositoryInterface

Image container of the product.

$urlRewriteStorage

\UrlRewriteStorage

Url rewrite storage.

Adds a new product in the database.

add(\ProductInterface $product) : integer
Throws
\InvalidArgumentException

If the provided product is not valid.

Arguments

$product

\ProductInterface

Product entity which holds the values for the database columns.

Response

integer

Id of inserted product.

Removes a product from the database by the given id.

deleteProductById(\IdType $productId) : \ProductRepositoryInterface|$this

Arguments

$productId

\IdType

Id of expected product entity.

Response

\ProductRepositoryInterface|$this

Same instance for chained method calls.

Gets a stored product by the given id.

getProductById(\IdType $productId) : \StoredProductInterface

Arguments

$productId

\IdType

Id of expected product entity.

Response

\StoredProductInterface

Product entity with the expected product id.

Returns the count of all product entries.

getProductsCount() : integer

Response

integer

Updates an existing product in the database.

store(\StoredProductInterface $product) : \ProductRepositoryInterface|$this
Throws
\InvalidArgumentException

If the provided product is not valid.

Arguments

$product

\StoredProductInterface

Product entity to update.

Response

\ProductRepositoryInterface|$this

Same instance for chained method calls.

Properties

reader

reader : \ProductRepositoryReaderInterface

writer

writer : \ProductRepositoryWriterInterface

deleter

deleter : \ProductRepositoryDeleterInterface

settingsRepo

settingsRepo : \ProductSettingsRepositoryInterface

addonValueService

addonValueService : \AddonValueServiceInterface

imageContainerRepo

imageContainerRepo : \ProductImageContainerRepositoryInterface

urlRewriteStorage

urlRewriteStorage : \UrlRewriteStorage
var

Type(s)

\UrlRewriteStorage