SetProductProviderInfoTrait
Trait to manage product provider information for an entity.
This trait provides methods to safely set properties on a ProductProviderInfo object.
It ensures that the productInfo object is initialized before setting any values.
Tags
Table of Contents
Properties
- $productInfo : null|ProductProviderInfo
Methods
- setProductProviderInfoProperties() : bool
- Set one of the predefined product provider properties.
- setProductProviderInfoProperty() : bool
- Internal method to set a single property on the `ProductProviderInfo` object.
Properties
$productInfo
public
null|ProductProviderInfo
$productInfo
The associated product provider information object.
Methods
setProductProviderInfoProperties()
Set one of the predefined product provider properties.
public
setProductProviderInfoProperties(string $property, mixed $value) : bool
This method maps certain standardized property names (from Prop) to the
internal productInfo object.
Supported properties include:
BUYING_PRICEBUYING_PRICE_MARGINBUYING_PRICE_REFERENCE_QUANTITYBUYING_PRICE_REFERENCE_QUANTITY_UNIT_CODEHAS_QUANTITY_DISCOUNTNEXT_BUYING_PRICENEXT_BUYING_PRICE_DATEPRIMARY
Parameters
- $property : string
-
The property name to set.
- $value : mixed
-
The value to assign.
Return values
bool —True if the property was handled, false otherwise.
setProductProviderInfoProperty()
Internal method to set a single property on the `ProductProviderInfo` object.
protected
setProductProviderInfoProperty(string $name, mixed $value) : bool
If the productInfo property is not yet initialized, it will be created automatically.
If the value is null, the property will be cleared.
Parameters
- $name : string
-
The property name to set on
ProductProviderInfo. - $value : mixed
-
The value to assign to the property.
Return values
bool —True if the property was successfully set or cleared, false otherwise.