You are here

public function Order::setAddress in Ubercart 8.4

Sets an address attached to the order.

Parameters

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

\Drupal\uc_store\Address $address: The address object.

Return value

$this

Overrides OrderInterface::setAddress

File

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

Class

Order
Defines the order entity class.

Namespace

Drupal\uc_order\Entity

Code

public function setAddress($type, Address $address) {
  $this
    ->set($type . '_first_name', $address
    ->getFirstName());
  $this
    ->set($type . '_last_name', $address
    ->getLastName());
  $this
    ->set($type . '_company', $address
    ->getCompany());
  $this
    ->set($type . '_street1', $address
    ->getStreet1());
  $this
    ->set($type . '_street2', $address
    ->getStreet2());
  $this
    ->set($type . '_city', $address
    ->getCity());
  $this
    ->set($type . '_zone', $address
    ->getZone());
  $this
    ->set($type . '_country', $address
    ->getCountry());
  $this
    ->set($type . '_postal_code', $address
    ->getPostalCode());
  $this
    ->set($type . '_phone', $address
    ->getPhone());
  return $this;
}