ProductAttributeService

Implements \ProductAttributeServiceInterface

Class ProductAttributeService

category

System

package

ProductModule

subpackage

Interfaces

Methods

Initialize the product attribute service.

__construct(\ProductAttributeRepositoryInterface $productAttributeRepo) 

Arguments

$productAttributeRepo

\ProductAttributeRepositoryInterface

Adds an product attribute to a product by the given id.

addAttribute(\IdType $productId, \ProductAttributeInterface $attribute) : integer

Arguments

$productId

\IdType

Id of product entity that adds the attribute.

$attribute

\ProductAttributeInterface

Product attribute entity to add.

Response

integer

Id of inserted product attribute.

Returns a stored product attribute entity by the given product attribute id.

getAttributeById(\IdType $productAttributeId) : \StoredProductAttributeInterface

Arguments

$productAttributeId

\IdType

Id of expected product attribute entity.

Response

\StoredProductAttributeInterface

Expected stored product attribute entity.

Returns a collection with all attribute entities that belongs to a product entity by the given product id.

getAttributesByProductId(\IdType $productId) : \StoredProductAttributeCollection

Arguments

$productId

\IdType

Id of product entity that contain the expected attributes.

Response

\StoredProductAttributeCollection

Collection with all attributes that belongs to the product.

Removes a product attribute entity by the given product attribute id.

removeAttributeById(\IdType $productAttributeId) : \ProductAttributeService|$this

Arguments

$productAttributeId

\IdType

Id of product attribute entity that should be deleted.

Response

\ProductAttributeService|$this

Same instance for chained method calls.

Removes product attributes by the given product id.

removeAttributesByProductId(\IdType $productId) : \ProductAttributeService|$this

Arguments

$productId

\IdType

Id of product entity of the attributes that should be deleted.

Response

\ProductAttributeService|$this

Same instance for chained method calls.

Updates the passed product attribute entity.

updateAttribute(\StoredProductAttributeInterface $attribute) : $this|\ProductAttributeService

Arguments

$attribute

\StoredProductAttributeInterface

Product attribute entity to update.

Response

$this|\ProductAttributeService

Same instance for chained method calls.

Properties

productAttributeRepo

productAttributeRepo : \ProductAttributeRepositoryInterface