commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CreatedByModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class CreatedByModel extends JsonObjectModel implements CreatedBy
23 {
28  protected $clientId;
29 
34  protected $externalUserId;
35 
40  protected $customer;
41 
46  protected $anonymousId;
47 
52  protected $associate;
53 
58  protected $attributedTo;
59 
60 
64  public function __construct(
65  ?string $clientId = null,
66  ?string $externalUserId = null,
68  ?string $anonymousId = null,
71  ) {
72  $this->clientId = $clientId;
73  $this->externalUserId = $externalUserId;
74  $this->customer = $customer;
75  $this->anonymousId = $anonymousId;
76  $this->associate = $associate;
77  $this->attributedTo = $attributedTo;
78  }
79 
86  public function getClientId()
87  {
88  if (is_null($this->clientId)) {
90  $data = $this->raw(self::FIELD_CLIENT_ID);
91  if (is_null($data)) {
92  return null;
93  }
94  $this->clientId = (string) $data;
95  }
96 
97  return $this->clientId;
98  }
99 
106  public function getExternalUserId()
107  {
108  if (is_null($this->externalUserId)) {
110  $data = $this->raw(self::FIELD_EXTERNAL_USER_ID);
111  if (is_null($data)) {
112  return null;
113  }
114  $this->externalUserId = (string) $data;
115  }
116 
117  return $this->externalUserId;
118  }
119 
126  public function getCustomer()
127  {
128  if (is_null($this->customer)) {
130  $data = $this->raw(self::FIELD_CUSTOMER);
131  if (is_null($data)) {
132  return null;
133  }
134 
135  $this->customer = CustomerReferenceModel::of($data);
136  }
137 
138  return $this->customer;
139  }
140 
147  public function getAnonymousId()
148  {
149  if (is_null($this->anonymousId)) {
151  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
152  if (is_null($data)) {
153  return null;
154  }
155  $this->anonymousId = (string) $data;
156  }
157 
158  return $this->anonymousId;
159  }
160 
167  public function getAssociate()
168  {
169  if (is_null($this->associate)) {
171  $data = $this->raw(self::FIELD_ASSOCIATE);
172  if (is_null($data)) {
173  return null;
174  }
175 
176  $this->associate = CustomerReferenceModel::of($data);
177  }
178 
179  return $this->associate;
180  }
181 
188  public function getAttributedTo()
189  {
190  if (is_null($this->attributedTo)) {
192  $data = $this->raw(self::FIELD_ATTRIBUTED_TO);
193  if (is_null($data)) {
194  return null;
195  }
196 
197  $this->attributedTo = AttributionModel::of($data);
198  }
199 
200  return $this->attributedTo;
201  }
202 
203 
207  public function setClientId(?string $clientId): void
208  {
209  $this->clientId = $clientId;
210  }
211 
215  public function setExternalUserId(?string $externalUserId): void
216  {
217  $this->externalUserId = $externalUserId;
218  }
219 
223  public function setCustomer(?CustomerReference $customer): void
224  {
225  $this->customer = $customer;
226  }
227 
231  public function setAnonymousId(?string $anonymousId): void
232  {
233  $this->anonymousId = $anonymousId;
234  }
235 
239  public function setAssociate(?CustomerReference $associate): void
240  {
241  $this->associate = $associate;
242  }
243 
247  public function setAttributedTo(?Attribution $attributedTo): void
248  {
249  $this->attributedTo = $attributedTo;
250  }
251 }
setAssociate(?CustomerReference $associate)
__construct(?string $clientId=null, ?string $externalUserId=null, ?CustomerReference $customer=null, ?string $anonymousId=null, ?CustomerReference $associate=null, ?Attribution $attributedTo=null)