You are here

interface ProductVariationStorageInterface in Commerce Core 8.2

Defines the interface for product variation storage.

Hierarchy

Expanded class hierarchy of ProductVariationStorageInterface

All classes that implement ProductVariationStorageInterface

1 file declares its use of ProductVariationStorageInterface
ProductVariationContext.php in modules/product/src/ContextProvider/ProductVariationContext.php

File

modules/product/src/ProductVariationStorageInterface.php, line 11

Namespace

Drupal\commerce_product
View source
interface ProductVariationStorageInterface extends ContentEntityStorageInterface {

  /**
   * Loads the product variation for the given SKU.
   *
   * @param string $sku
   *   The SKU.
   *
   * @return \Drupal\commerce_product\Entity\ProductVariationInterface|null
   *   The product variation, or NULL if not found.
   */
  public function loadBySku($sku);

  /**
   * Loads the product variation from context.
   *
   * Uses the variation specified in the URL (?v=) if it's active and
   * belongs to the current product.
   *
   * Note: The returned variation is not guaranteed to be enabled, the caller
   * needs to check it against the list from loadEnabled().
   *
   * @param \Drupal\commerce_product\Entity\ProductInterface $product
   *   The current product.
   *
   * @return \Drupal\commerce_product\Entity\ProductVariationInterface
   *   The product variation.
   */
  public function loadFromContext(ProductInterface $product);

  /**
   * Loads the enabled product variations for the given product.
   *
   * Enabled variations are active variations that have been filtered through
   * the FILTER_VARIATIONS event.
   *
   * @param \Drupal\commerce_product\Entity\ProductInterface $product
   *   The product.
   *
   * @return \Drupal\commerce_product\Entity\ProductVariationInterface[]
   *   The enabled product variations.
   */
  public function loadEnabled(ProductInterface $product);

}

Members

Namesort descending Modifiers Type Description Overrides
ContentEntityStorageInterface::createWithSampleValues public function Creates an entity with sample field values. 2
EntityStorageInterface::create public function Constructs a new entity object, without permanently saving it. 1
EntityStorageInterface::delete public function Deletes permanently saved entities. 1
EntityStorageInterface::deleteRevision public function Delete a specific entity revision. 4
EntityStorageInterface::FIELD_LOAD_CURRENT constant Load the most recent version of an entity's field data.
EntityStorageInterface::FIELD_LOAD_REVISION constant Load the version of an entity's field data specified in the entity.
EntityStorageInterface::getAggregateQuery public function Gets an aggregated query instance. 1
EntityStorageInterface::getEntityType public function Gets the entity type definition. 1
EntityStorageInterface::getEntityTypeId public function Gets the entity type ID. 1
EntityStorageInterface::getQuery public function Gets an entity query instance. 1
EntityStorageInterface::hasData public function Determines if the storage contains any data. 1
EntityStorageInterface::load public function Loads one entity. 1
EntityStorageInterface::loadByProperties public function Load entities by their property values. 1
EntityStorageInterface::loadMultiple public function Loads one or more entities. 1
EntityStorageInterface::loadRevision public function Load a specific entity revision. 4
EntityStorageInterface::loadUnchanged public function Loads an unchanged entity from the database. 1
EntityStorageInterface::resetCache public function Resets the internal, static entity cache. 1
EntityStorageInterface::restore public function Restores a previously saved entity. 1
EntityStorageInterface::save public function Saves the entity permanently. 1
ProductVariationStorageInterface::loadBySku public function Loads the product variation for the given SKU. 1
ProductVariationStorageInterface::loadEnabled public function Loads the enabled product variations for the given product. 1
ProductVariationStorageInterface::loadFromContext public function Loads the product variation from context. 1
RevisionableStorageInterface::getLatestRevisionId public function Returns the latest revision identifier for an entity. 2
RevisionableStorageInterface::loadMultipleRevisions public function Loads multiple entity revisions. 2
TranslatableRevisionableStorageInterface::createRevision public function Creates a new revision starting off from the specified entity object. Overrides RevisionableStorageInterface::createRevision 2
TranslatableRevisionableStorageInterface::getLatestTranslationAffectedRevisionId public function Returns the latest revision affecting the specified translation. 2
TranslatableStorageInterface::createTranslation public function Constructs a new entity translation object, without permanently saving it. 2