You are here

public function PriceList::getItemIds in Commerce Pricelist 8.2

Gets the price list item IDs.

No matching getItems() method is provided because there can potentially be thousands of items in a single list, making it too costly to load them all at once.

Return value

int[] The price list item IDs.

Overrides PriceListInterface::getItemIds

File

src/Entity/PriceList.php, line 270

Class

PriceList
Defines the Price list entity.

Namespace

Drupal\commerce_pricelist\Entity

Code

public function getItemIds() {
  if ($this
    ->isNew()) {
    return [];
  }
  $query = $this
    ->entityTypeManager()
    ->getStorage('commerce_pricelist_item')
    ->getQuery();
  $query
    ->condition('price_list_id', $this
    ->id());
  $result = $query
    ->execute();
  return $result;
}