ProductRepositoryWriter

Implements \ProductRepositoryWriterInterface

Class ProductRepositoryWriter

category

System

package

Product

subpackage

Repositories

Methods

ProductRepositoryWriter constructor.

__construct(\CI_DB_query_builder $db, \LanguageProviderInterface $languageProvider) 
Throws
\InvalidArgumentException

Arguments

$db

\CI_DB_query_builder

$languageProvider

\LanguageProviderInterface

Convert the product instance data to an array.

_parseProductData(\ProductInterface $product) : array

Arguments

Response

array

Convert the product description instance data to an array.

_parseProductDescriptionData(\ProductInterface $product, \LanguageCode $languageCode) : array
Throws
\InvalidArgumentException

If the provided language code or product is not valid.

Arguments

$languageCode

\LanguageCode

Response

array

Convert the product quantity unit instance data to an array.

_parseProductsQuantityUnitData(\IdType $productId, \IdType $quantityUnitId) : array

Arguments

$productId

\IdType

$quantityUnitId

\IdType

Response

array

Insert

insert(\ProductInterface $product) : integer

Saves a new product in the database.

Throws
\InvalidArgumentException

If the provided product is not valid.

\UnexpectedValueException

When no language id was found by the given language code.

Arguments

$product

\ProductInterface

Product entity which holds the values for the database columns.

Response

integer

Id of inserted product.

Update

update(\StoredProductInterface $product) : \ProductRepositoryWriter

Updates a product in the database.

Throws
\InvalidArgumentException
\UnexpectedValueException

When no language id was found by the given language code.

Arguments

$product

\StoredProductInterface

Product entity to update.

Response

\ProductRepositoryWriter

Same instance for chained method calls.

Properties

The database connection.

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

Used for fetching the language data.

languageProvider : \LanguageProviderInterface