public function ProductVariation::getAttributeValueIds in Commerce Core 8.2
Gets the attribute value IDs.
Return value
int[] The attribute value IDs, keyed by field name.
Overrides ProductVariationInterface::getAttributeValueIds
File
- modules/
product/ src/ Entity/ ProductVariation.php, line 292
Class
- ProductVariation
- Defines the product variation entity class.
Namespace
Drupal\commerce_product\EntityCode
public function getAttributeValueIds() {
$attribute_ids = [];
foreach ($this
->getAttributeFieldNames() as $field_name) {
$field = $this
->get($field_name);
if (!$field
->isEmpty()) {
$attribute_ids[$field_name] = $field->target_id;
}
}
return $attribute_ids;
}