ProductAttributeRepository
in package
implements
ProductAttributeRepositoryInterface
Class ProductAttributeRepository
Tags
Interfaces, Classes and Traits
- ProductAttributeRepositoryInterface
- Interface ProductAttributeRepositoryInterface
Table of Contents
- $deleter : ProductAttributeRepositoryDeleterInterface
- $reader : ProductAttributeRepositoryReaderInterface
- $writer : ProductAttributeRepositoryWriterInterface
- __construct() : mixed
- Initialize the product attribute repository.
- addToProduct() : int
- Adds an product attribute to a product by the given id.
- deleteAttributeById() : ProductAttributeRepository|$this
- Removes a product attribute entity by the given product attribute id.
- deleteAttributesByProductId() : ProductAttributeRepository|$this
- Removes product attributes by the given product id.
- getAttributeById() : StoredProductAttributeInterface
- Returns a stored product attribute entity by the given product attribute id.
- getAttributesByProductId() : StoredProductAttributeCollection
- Returns a collection with all attribute entities that belongs to a product entity by the given product id.
- store() : ProductAttributeRepository|$this
- Stores/Updates the passed product attribute entity.
Properties
$deleter
protected
ProductAttributeRepositoryDeleterInterface
$deleter
$reader
protected
ProductAttributeRepositoryReaderInterface
$reader
$writer
protected
ProductAttributeRepositoryWriterInterface
$writer
Methods
__construct()
Initialize the product attribute repository.
public
__construct(ProductAttributeRepositoryReaderInterface $reader, ProductAttributeRepositoryWriterInterface $writer, ProductAttributeRepositoryDeleterInterface $deleter) : mixed
Parameters
- $reader : ProductAttributeRepositoryReaderInterface
- $writer : ProductAttributeRepositoryWriterInterface
- $deleter : ProductAttributeRepositoryDeleterInterface
Return values
mixed —addToProduct()
Adds an product attribute to a product by the given id.
public
addToProduct(IdType $productId, ProductAttributeInterface $productAttribute) : int
Parameters
- $productId : IdType
-
Id of product entity that adds the attribute.
- $productAttribute : ProductAttributeInterface
-
Product attribute entity to add.
Return values
int —Id of added product attribute entity.
deleteAttributeById()
Removes a product attribute entity by the given product attribute id.
public
deleteAttributeById(IdType $productAttributeId) : ProductAttributeRepository|$this
Parameters
- $productAttributeId : IdType
-
Id of product attribute entity that should be deleted.
Return values
ProductAttributeRepository|$this —Same instance for chained method calls.
deleteAttributesByProductId()
Removes product attributes by the given product id.
public
deleteAttributesByProductId(IdType $productId) : ProductAttributeRepository|$this
Parameters
- $productId : IdType
-
Id of product entity of the attributes that should be deleted.
Return values
ProductAttributeRepository|$this —Same instance for chained method calls.
getAttributeById()
Returns a stored product attribute entity by the given product attribute id.
public
getAttributeById(IdType $productAttributeId) : StoredProductAttributeInterface
Parameters
- $productAttributeId : IdType
-
Id of expected product attribute entity.
Return values
StoredProductAttributeInterface —Expected stored product attribute entity.
getAttributesByProductId()
Returns a collection with all attribute entities that belongs to a product entity by the given product id.
public
getAttributesByProductId(IdType $productId) : StoredProductAttributeCollection
Parameters
- $productId : IdType
-
Id of product entity that contain the expected attributes.
Return values
StoredProductAttributeCollection —Collection with all attributes that belongs to the product.
store()
Stores/Updates the passed product attribute entity.
public
store(StoredProductAttributeInterface $productAttribute) : ProductAttributeRepository|$this
Parameters
- $productAttribute : StoredProductAttributeInterface
-
Product attribute entity to store.
Return values
ProductAttributeRepository|$this —Same instance for chained method calls.