ProductAttributeServiceInterface
in
Interface ProductAttributeServiceInterface
Tags
Table of Contents
- addAttribute() : int
- Adds an product attribute to a product by the given 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.
- removeAttributeById() : ProductAttributeServiceInterface|$this
- Removes a product attribute entity by the given product attribute id.
- removeAttributesByProductId() : ProductAttributeServiceInterface|$this
- Removes product attributes by the given product id.
- updateAttribute() : $this|ProductAttributeServiceInterface
- Updates the passed product attribute entity.
Methods
addAttribute()
Adds an product attribute to a product by the given id.
public
addAttribute(IdType $productId, ProductAttributeInterface $attribute) : int
Parameters
- $productId : IdType
-
Id of product entity that adds the attribute.
- $attribute : ProductAttributeInterface
-
Product attribute entity to add.
Return values
int —Id of inserted product attribute.
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.
removeAttributeById()
Removes a product attribute entity by the given product attribute id.
public
removeAttributeById(IdType $productAttributeId) : ProductAttributeServiceInterface|$this
Parameters
- $productAttributeId : IdType
-
Id of product attribute entity that should be deleted.
Return values
ProductAttributeServiceInterface|$this —Same instance for chained method calls.
removeAttributesByProductId()
Removes product attributes by the given product id.
public
removeAttributesByProductId(IdType $productId) : ProductAttributeServiceInterface|$this
Parameters
- $productId : IdType
-
Id of product entity of the attributes that should be deleted.
Return values
ProductAttributeServiceInterface|$this —Same instance for chained method calls.
updateAttribute()
Updates the passed product attribute entity.
public
updateAttribute(StoredProductAttributeInterface $attribute) : $this|ProductAttributeServiceInterface
Parameters
- $attribute : StoredProductAttributeInterface
-
Product attribute entity to update.
Return values
$this|ProductAttributeServiceInterface —Same instance for chained method calls.