commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderEditDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class OrderEditDraftModel extends JsonObjectModel implements OrderEditDraft
26 {
31  protected $key;
32 
37  protected $resource;
38 
43  protected $stagedActions;
44 
49  protected $custom;
50 
55  protected $comment;
56 
61  protected $dryRun;
62 
63 
67  public function __construct(
68  ?string $key = null,
69  ?OrderReference $resource = null,
71  ?CustomFieldsDraft $custom = null,
72  ?string $comment = null,
73  ?bool $dryRun = null
74  ) {
75  $this->key = $key;
76  $this->resource = $resource;
77  $this->stagedActions = $stagedActions;
78  $this->custom = $custom;
79  $this->comment = $comment;
80  $this->dryRun = $dryRun;
81  }
82 
89  public function getKey()
90  {
91  if (is_null($this->key)) {
93  $data = $this->raw(self::FIELD_KEY);
94  if (is_null($data)) {
95  return null;
96  }
97  $this->key = (string) $data;
98  }
99 
100  return $this->key;
101  }
102 
109  public function getResource()
110  {
111  if (is_null($this->resource)) {
113  $data = $this->raw(self::FIELD_RESOURCE);
114  if (is_null($data)) {
115  return null;
116  }
117 
118  $this->resource = OrderReferenceModel::of($data);
119  }
120 
121  return $this->resource;
122  }
123 
131  public function getStagedActions()
132  {
133  if (is_null($this->stagedActions)) {
135  $data = $this->raw(self::FIELD_STAGED_ACTIONS);
136  if (is_null($data)) {
137  return null;
138  }
139  $this->stagedActions = StagedOrderUpdateActionCollection::fromArray($data);
140  }
141 
142  return $this->stagedActions;
143  }
144 
151  public function getCustom()
152  {
153  if (is_null($this->custom)) {
155  $data = $this->raw(self::FIELD_CUSTOM);
156  if (is_null($data)) {
157  return null;
158  }
159 
160  $this->custom = CustomFieldsDraftModel::of($data);
161  }
162 
163  return $this->custom;
164  }
165 
172  public function getComment()
173  {
174  if (is_null($this->comment)) {
176  $data = $this->raw(self::FIELD_COMMENT);
177  if (is_null($data)) {
178  return null;
179  }
180  $this->comment = (string) $data;
181  }
182 
183  return $this->comment;
184  }
185 
194  public function getDryRun()
195  {
196  if (is_null($this->dryRun)) {
198  $data = $this->raw(self::FIELD_DRY_RUN);
199  if (is_null($data)) {
200  return null;
201  }
202  $this->dryRun = (bool) $data;
203  }
204 
205  return $this->dryRun;
206  }
207 
208 
212  public function setKey(?string $key): void
213  {
214  $this->key = $key;
215  }
216 
220  public function setResource(?OrderReference $resource): void
221  {
222  $this->resource = $resource;
223  }
224 
229  {
230  $this->stagedActions = $stagedActions;
231  }
232 
236  public function setCustom(?CustomFieldsDraft $custom): void
237  {
238  $this->custom = $custom;
239  }
240 
244  public function setComment(?string $comment): void
245  {
246  $this->comment = $comment;
247  }
248 
252  public function setDryRun(?bool $dryRun): void
253  {
254  $this->dryRun = $dryRun;
255  }
256 }
setStagedActions(?StagedOrderUpdateActionCollection $stagedActions)
__construct(?string $key=null, ?OrderReference $resource=null, ?StagedOrderUpdateActionCollection $stagedActions=null, ?CustomFieldsDraft $custom=null, ?string $comment=null, ?bool $dryRun=null)