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
112 public function getUpdateProductData()
113 {
114 if (is_null($this->updateProductData)) {
116 $data = $this->raw(self::FIELD_UPDATE_PRODUCT_DATA);
117 if (is_null($data)) {
118 return null;
119 }
120 $this->updateProductData = (bool) $data;
121 }
122
124 }
125
133 public function getAnonymousId()
134 {
135 if (is_null($this->anonymousId)) {
137 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
138 if (is_null($data)) {
139 return null;
140 }
141 $this->anonymousId = (string) $data;
142 }
143
144 return $this->anonymousId;
145 }
146
147
152 {
153 $this->anonymousCart = $anonymousCart;
154 }
155
159 public function setMergeMode(?string $mergeMode): void
160 {
161 $this->mergeMode = $mergeMode;
162 }
163
167 public function setUpdateProductData(?bool $updateProductData): void
168 {
169 $this->updateProductData = $updateProductData;
170 }
171
175 public function setAnonymousId(?string $anonymousId): void
176 {
177 $this->anonymousId = $anonymousId;
178 }
179}
__construct(?CartResourceIdentifier $anonymousCart=null, ?string $mergeMode=null, ?bool $updateProductData=null, ?string $anonymousId=null)
setAnonymousCart(?CartResourceIdentifier $anonymousCart)