ProductRepositoryWriter
in package
implements
ProductRepositoryWriterInterface
Class ProductRepositoryWriter
Tags
Interfaces, Classes and Traits
- ProductRepositoryWriterInterface
- Interface ProductRepositoryWriterInterface
Table of Contents
- $db : CI_DB_query_builder
- The database connection.
- $languageProvider : LanguageProviderInterface
- Used for fetching the language data.
- __construct() : mixed
- ProductRepositoryWriter constructor.
- insert() : int
- Insert
- update() : ProductRepositoryWriter
- Update
- _parseProductData() : array<string|int, mixed>
- Convert the product instance data to an array.
- _parseProductDescriptionData() : array<string|int, mixed>
- Convert the product description instance data to an array.
- _parseProductsQuantityUnitData() : array<string|int, mixed>
- Convert the product quantity unit instance data to an array.
Properties
$db
The database connection.
protected
CI_DB_query_builder
$db
$languageProvider
Used for fetching the language data.
protected
LanguageProviderInterface
$languageProvider
Methods
__construct()
ProductRepositoryWriter constructor.
public
__construct(CI_DB_query_builder $db, LanguageProviderInterface $languageProvider) : mixed
Parameters
- $db : CI_DB_query_builder
- $languageProvider : LanguageProviderInterface
Tags
Return values
mixed —insert()
Insert
public
insert(ProductInterface $product) : int
Saves a new product in the database.
Parameters
- $product : ProductInterface
-
Product entity which holds the values for the database columns.
Tags
Return values
int —Id of inserted product.
update()
Update
public
update(StoredProductInterface $product) : ProductRepositoryWriter
Updates a product in the database.
Parameters
- $product : StoredProductInterface
-
Product entity to update.
Tags
Return values
ProductRepositoryWriter —Same instance for chained method calls.
_parseProductData()
Convert the product instance data to an array.
protected
_parseProductData(ProductInterface $product) : array<string|int, mixed>
Parameters
- $product : ProductInterface
Return values
array<string|int, mixed> —_parseProductDescriptionData()
Convert the product description instance data to an array.
protected
_parseProductDescriptionData(ProductInterface $product, LanguageCode $languageCode) : array<string|int, mixed>
Parameters
- $product : ProductInterface
- $languageCode : LanguageCode
Tags
Return values
array<string|int, mixed> —_parseProductsQuantityUnitData()
Convert the product quantity unit instance data to an array.
protected
_parseProductsQuantityUnitData(IdType $productId, IdType $quantityUnitId) : array<string|int, mixed>