commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MergeCartDraftModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
26 protected $anonymousCart;
27
32 protected $mergeMode;
33
39
44 protected $anonymousId;
45
46
50 public function __construct(
52 ?string $mergeMode = null,
53 ?bool $updateProductData = null,
54 ?string $anonymousId = null
55 ) {
56 $this->anonymousCart = $anonymousCart;
57 $this->mergeMode = $mergeMode;
58 $this->updateProductData = $updateProductData;
59 $this->anonymousId = $anonymousId;
60 }
61
68 public function getAnonymousCart()
69 {
70 if (is_null($this->anonymousCart)) {
72 $data = $this->raw(self::FIELD_ANONYMOUS_CART);
73 if (is_null($data)) {
74 return null;
75 }
76
77 $this->anonymousCart = CartResourceIdentifierModel::of($data);
78 }
79
81 }
82
89 public function getMergeMode()
90 {
91 if (is_null($this->mergeMode)) {
93 $data = $this->raw(self::FIELD_MERGE_MODE);
94 if (is_null($data)) {
95 return null;
96 }
97 $this->mergeMode = (string) $data;
98 }
99
100 return $this->mergeMode;
101 }
102
109 public function getUpdateProductData()
110 {
111 if (is_null($this->updateProductData)) {
113 $data = $this->raw(self::FIELD_UPDATE_PRODUCT_DATA);
114 if (is_null($data)) {
115 return null;
116 }
117 $this->updateProductData = (bool) $data;
118 }
119
121 }
122
130 public function getAnonymousId()
131 {
132 if (is_null($this->anonymousId)) {
134 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
135 if (is_null($data)) {
136 return null;
137 }
138 $this->anonymousId = (string) $data;
139 }
140
141 return $this->anonymousId;
142 }
143
144
149 {
150 $this->anonymousCart = $anonymousCart;
151 }
152
156 public function setMergeMode(?string $mergeMode): void
157 {
158 $this->mergeMode = $mergeMode;
159 }
160
164 public function setUpdateProductData(?bool $updateProductData): void
165 {
166 $this->updateProductData = $updateProductData;
167 }
168
172 public function setAnonymousId(?string $anonymousId): void
173 {
174 $this->anonymousId = $anonymousId;
175 }
176}
__construct(?CartResourceIdentifier $anonymousCart=null, ?string $mergeMode=null, ?bool $updateProductData=null, ?string $anonymousId=null)
setAnonymousCart(?CartResourceIdentifier $anonymousCart)