You are here

public function PriceList::getCustomerId in Commerce Pricelist 8.2

Gets the customer ID.

Return value

int|null The customer ID, or NULL if the price list is not limited to a specific customer.

Overrides PriceListInterface::getCustomerId

Deprecated

in commerce_pricelist:8.x-2.0 and is removed from commerce_pricelist:8.x-3.0. Use $this->getCustomers() instead.

See also

https://www.drupal.org/project/commerce_pricelist/issues/3171289

File

src/Entity/PriceList.php, line 168

Class

PriceList
Defines the Price list entity.

Namespace

Drupal\commerce_pricelist\Entity

Code

public function getCustomerId() {
  if ($this
    ->get('customers')
    ->isEmpty()) {
    return NULL;
  }
  return $this
    ->get('customers')
    ->get(0)->target_id;
}