You are here

public function ProductVariation::getProductId in Commerce Core 8.2

Gets the parent product ID.

Return value

int|null The product ID, or null.

Overrides ProductVariationInterface::getProductId

4 calls to ProductVariation::getProductId()
ProductVariation::generateTitle in modules/product/src/Entity/ProductVariation.php
Generates the variation title based on attribute values.
ProductVariation::getCacheTagsToInvalidate in modules/product/src/Entity/ProductVariation.php
Returns the cache tags that should be used to invalidate caches.
ProductVariation::toUrl in modules/product/src/Entity/ProductVariation.php
Gets the URL object for the entity.
ProductVariation::urlRouteParameters in modules/product/src/Entity/ProductVariation.php
Gets an array of placeholders for this entity.

File

modules/product/src/Entity/ProductVariation.php, line 152

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getProductId() {
  return $this
    ->get('product_id')->target_id;
}