class ProductCombination2ValuePair (View source)

Class ProductCombination2ValuePair Used to represent the relation between a variant and its attributes.

Example: a product "shirt" has a variant "shirt XL white" linked to the attributes "size: XL" and "color: white". This is represented with two ProductCombination2ValuePair objects:

  • One for "size: XL":
    • $object->fk_prod_combination ID of the ProductCombination object between product "shirt" and its variant "shirt XL white"
    • $object->fk_prod_attr ID of the ProductAttribute object "size"
    • $object->fk_prod_attr_val ID of the ProductAttributeValue object "XL"
  • Another for "color: white":
    • $object->fk_prod_combination ID of the ProductCombination object between product "shirt" and its variant "shirt XL white"
    • $object->fk_prod_attr ID of the ProductAttribute object "color"
    • $object->fk_prod_attr_val ID of the ProductAttributeValue object "white"

Properties

int $id

ID of this ProductCombination2ValuePair

int $fk_prod_combination

ID of the ProductCombination linked to this object (ex: ID of the ProductCombination between product "shirt" and its variant "shirt XL white")

int $fk_prod_attr

ID of the ProductAttribute linked to this object (ex: ID of the ProductAttribute "color")

int $fk_prod_attr_val

ID of the ProductAttributeValue linked to this object (ex: ID of the ProductAttributeValue "white")

string $error

Error message

string[] $errors

Array of error messages

Methods

__construct(DoliDB $db)

Constructor

string
__toString()

Translates this class to a human-readable string

int
create(User $user)

Create a ProductCombination2ValuePair

fetchByFkCombination(int $fk_combination)

Retrieve all ProductCombination2ValuePair linked to a given ProductCombination ID.

int<-1, -1>|int<1, 1>
deleteByFkCombination(int $fk_combination)

Delete all ProductCombination2ValuePair linked to a given ProductCombination ID.

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

string __toString()

Translates this class to a human-readable string

Return Value

string

int create(User $user)

Create a ProductCombination2ValuePair

Parameters

User $user

User that creates //not used

Return Value

int

Return 1 if OK, -1 if KO

-1|ProductCombination2ValuePair[] fetchByFkCombination(int $fk_combination)

Retrieve all ProductCombination2ValuePair linked to a given ProductCombination ID.

Parameters

int $fk_combination

ID of the ProductCombination

Return Value

-1|ProductCombination2ValuePair[]

Return <0 if KO, array of ProductCombination2ValuePair if OK

int<-1, -1>|int<1, 1> deleteByFkCombination(int $fk_combination)

Delete all ProductCombination2ValuePair linked to a given ProductCombination ID.

Parameters

int $fk_combination

ID of the ProductCombination

Return Value

int<-1, -1>|int<1, 1>

-1 if KO, 1 if OK