commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomerChangeAddressActionModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'changeAddress';
29  protected $action;
30 
35  protected $addressId;
36 
41  protected $addressKey;
42 
47  protected $address;
48 
49 
53  public function __construct(
54  ?string $addressId = null,
55  ?string $addressKey = null,
56  ?BaseAddress $address = null,
57  ?string $action = null
58  ) {
59  $this->addressId = $addressId;
60  $this->addressKey = $addressKey;
61  $this->address = $address;
62  $this->action = $action ?? self::DISCRIMINATOR_VALUE;
63  }
64 
69  public function getAction()
70  {
71  if (is_null($this->action)) {
73  $data = $this->raw(self::FIELD_ACTION);
74  if (is_null($data)) {
75  return null;
76  }
77  $this->action = (string) $data;
78  }
79 
80  return $this->action;
81  }
82 
89  public function getAddressId()
90  {
91  if (is_null($this->addressId)) {
93  $data = $this->raw(self::FIELD_ADDRESS_ID);
94  if (is_null($data)) {
95  return null;
96  }
97  $this->addressId = (string) $data;
98  }
99 
100  return $this->addressId;
101  }
102 
109  public function getAddressKey()
110  {
111  if (is_null($this->addressKey)) {
113  $data = $this->raw(self::FIELD_ADDRESS_KEY);
114  if (is_null($data)) {
115  return null;
116  }
117  $this->addressKey = (string) $data;
118  }
119 
120  return $this->addressKey;
121  }
122 
129  public function getAddress()
130  {
131  if (is_null($this->address)) {
133  $data = $this->raw(self::FIELD_ADDRESS);
134  if (is_null($data)) {
135  return null;
136  }
137 
138  $this->address = BaseAddressModel::of($data);
139  }
140 
141  return $this->address;
142  }
143 
144 
148  public function setAddressId(?string $addressId): void
149  {
150  $this->addressId = $addressId;
151  }
152 
156  public function setAddressKey(?string $addressKey): void
157  {
158  $this->addressKey = $addressKey;
159  }
160 
164  public function setAddress(?BaseAddress $address): void
165  {
166  $this->address = $address;
167  }
168 }
__construct(?string $addressId=null, ?string $addressKey=null, ?BaseAddress $address=null, ?string $action=null)