commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductVariantPatchModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
25 {
30  protected $productVariant;
31 
36  protected $attributes;
37 
42  protected $staged;
43 
48  protected $product;
49 
50 
54  public function __construct(
56  ?Attributes $attributes = null,
57  ?bool $staged = null,
59  ) {
60  $this->productVariant = $productVariant;
61  $this->attributes = $attributes;
62  $this->staged = $staged;
63  $this->product = $product;
64  }
65 
73  public function getProductVariant()
74  {
75  if (is_null($this->productVariant)) {
77  $data = $this->raw(self::FIELD_PRODUCT_VARIANT);
78  if (is_null($data)) {
79  return null;
80  }
81 
82  $this->productVariant = ProductVariantKeyReferenceModel::of($data);
83  }
84 
85  return $this->productVariant;
86  }
87 
100  public function getAttributes()
101  {
102  if (is_null($this->attributes)) {
104  $data = $this->raw(self::FIELD_ATTRIBUTES);
105  if (is_null($data)) {
106  return null;
107  }
108 
109  $this->attributes = AttributesModel::of($data);
110  }
111 
112  return $this->attributes;
113  }
114 
121  public function getStaged()
122  {
123  if (is_null($this->staged)) {
125  $data = $this->raw(self::FIELD_STAGED);
126  if (is_null($data)) {
127  return null;
128  }
129  $this->staged = (bool) $data;
130  }
131 
132  return $this->staged;
133  }
134 
141  public function getProduct()
142  {
143  if (is_null($this->product)) {
145  $data = $this->raw(self::FIELD_PRODUCT);
146  if (is_null($data)) {
147  return null;
148  }
149 
150  $this->product = ProductKeyReferenceModel::of($data);
151  }
152 
153  return $this->product;
154  }
155 
156 
161  {
162  $this->productVariant = $productVariant;
163  }
164 
168  public function setAttributes(?Attributes $attributes): void
169  {
170  $this->attributes = $attributes;
171  }
172 
176  public function setStaged(?bool $staged): void
177  {
178  $this->staged = $staged;
179  }
180 
184  public function setProduct(?ProductKeyReference $product): void
185  {
186  $this->product = $product;
187  }
188 }
__construct(?ProductVariantKeyReference $productVariant=null, ?Attributes $attributes=null, ?bool $staged=null, ?ProductKeyReference $product=null)