You are here

public function Order::getAddress in Ubercart 8.4

Returns an address attached to the order.

Parameters

string $type: The address type, usually 'billing' or 'delivery'.

Return value

\Drupal\uc_store\Address The address object.

Overrides OrderInterface::getAddress

File

uc_order/src/Entity/Order.php, line 427

Class

Order
Defines the order entity class.

Namespace

Drupal\uc_order\Entity

Code

public function getAddress($type) {
  $address = Address::create();
  $address
    ->setFirstName($this
    ->get($type . '_first_name')->value)
    ->setLastName($this
    ->get($type . '_last_name')->value)
    ->setCompany($this
    ->get($type . '_company')->value)
    ->setStreet1($this
    ->get($type . '_street1')->value)
    ->setStreet2($this
    ->get($type . '_street2')->value)
    ->setCity($this
    ->get($type . '_city')->value)
    ->setZone($this
    ->get($type . '_zone')->value)
    ->setCountry($this
    ->get($type . '_country')->value)
    ->setPostalCode($this
    ->get($type . '_postal_code')->value)
    ->setPhone($this
    ->get($type . '_phone')->value);
  return $address;
}