commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
QuoteDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
26 final class QuoteDraftModel extends JsonObjectModel implements QuoteDraft
27 {
32  protected $key;
33 
38  protected $stagedQuote;
39 
45 
51 
56  protected $state;
57 
62  protected $custom;
63 
64 
68  public function __construct(
69  ?string $key = null,
71  ?int $stagedQuoteVersion = null,
72  ?bool $stagedQuoteStateToSent = null,
73  ?StateReference $state = null,
75  ) {
76  $this->key = $key;
77  $this->stagedQuote = $stagedQuote;
78  $this->stagedQuoteVersion = $stagedQuoteVersion;
79  $this->stagedQuoteStateToSent = $stagedQuoteStateToSent;
80  $this->state = $state;
81  $this->custom = $custom;
82  }
83 
90  public function getKey()
91  {
92  if (is_null($this->key)) {
94  $data = $this->raw(self::FIELD_KEY);
95  if (is_null($data)) {
96  return null;
97  }
98  $this->key = (string) $data;
99  }
100 
101  return $this->key;
102  }
103 
110  public function getStagedQuote()
111  {
112  if (is_null($this->stagedQuote)) {
114  $data = $this->raw(self::FIELD_STAGED_QUOTE);
115  if (is_null($data)) {
116  return null;
117  }
118 
119  $this->stagedQuote = StagedQuoteResourceIdentifierModel::of($data);
120  }
121 
122  return $this->stagedQuote;
123  }
124 
131  public function getStagedQuoteVersion()
132  {
133  if (is_null($this->stagedQuoteVersion)) {
135  $data = $this->raw(self::FIELD_STAGED_QUOTE_VERSION);
136  if (is_null($data)) {
137  return null;
138  }
139  $this->stagedQuoteVersion = (int) $data;
140  }
141 
143  }
144 
151  public function getStagedQuoteStateToSent()
152  {
153  if (is_null($this->stagedQuoteStateToSent)) {
155  $data = $this->raw(self::FIELD_STAGED_QUOTE_STATE_TO_SENT);
156  if (is_null($data)) {
157  return null;
158  }
159  $this->stagedQuoteStateToSent = (bool) $data;
160  }
161 
163  }
164 
172  public function getState()
173  {
174  if (is_null($this->state)) {
176  $data = $this->raw(self::FIELD_STATE);
177  if (is_null($data)) {
178  return null;
179  }
180 
181  $this->state = StateReferenceModel::of($data);
182  }
183 
184  return $this->state;
185  }
186 
197  public function getCustom()
198  {
199  if (is_null($this->custom)) {
201  $data = $this->raw(self::FIELD_CUSTOM);
202  if (is_null($data)) {
203  return null;
204  }
205 
206  $this->custom = CustomFieldsDraftModel::of($data);
207  }
208 
209  return $this->custom;
210  }
211 
212 
216  public function setKey(?string $key): void
217  {
218  $this->key = $key;
219  }
220 
225  {
226  $this->stagedQuote = $stagedQuote;
227  }
228 
232  public function setStagedQuoteVersion(?int $stagedQuoteVersion): void
233  {
234  $this->stagedQuoteVersion = $stagedQuoteVersion;
235  }
236 
241  {
242  $this->stagedQuoteStateToSent = $stagedQuoteStateToSent;
243  }
244 
248  public function setState(?StateReference $state): void
249  {
250  $this->state = $state;
251  }
252 
256  public function setCustom(?CustomFieldsDraft $custom): void
257  {
258  $this->custom = $custom;
259  }
260 }
setStagedQuote(?StagedQuoteResourceIdentifier $stagedQuote)
__construct(?string $key=null, ?StagedQuoteResourceIdentifier $stagedQuote=null, ?int $stagedQuoteVersion=null, ?bool $stagedQuoteStateToSent=null, ?StateReference $state=null, ?CustomFieldsDraft $custom=null)
setStagedQuoteStateToSent(?bool $stagedQuoteStateToSent)