commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AttributeGroupDraftModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
28 protected $name;
29
34 protected $description;
35
40 protected $attributes;
41
46 protected $key;
47
48
52 public function __construct(
53 ?LocalizedString $name = null,
56 ?string $key = null
57 ) {
58 $this->name = $name;
59 $this->description = $description;
60 $this->attributes = $attributes;
61 $this->key = $key;
62 }
63
70 public function getName()
71 {
72 if (is_null($this->name)) {
74 $data = $this->raw(self::FIELD_NAME);
75 if (is_null($data)) {
76 return null;
77 }
78
79 $this->name = LocalizedStringModel::of($data);
80 }
81
82 return $this->name;
83 }
84
91 public function getDescription()
92 {
93 if (is_null($this->description)) {
95 $data = $this->raw(self::FIELD_DESCRIPTION);
96 if (is_null($data)) {
97 return null;
98 }
99
100 $this->description = LocalizedStringModel::of($data);
101 }
102
103 return $this->description;
104 }
105
112 public function getAttributes()
113 {
114 if (is_null($this->attributes)) {
116 $data = $this->raw(self::FIELD_ATTRIBUTES);
117 if (is_null($data)) {
118 return null;
119 }
120 $this->attributes = AttributeReferenceCollection::fromArray($data);
121 }
122
123 return $this->attributes;
124 }
125
132 public function getKey()
133 {
134 if (is_null($this->key)) {
136 $data = $this->raw(self::FIELD_KEY);
137 if (is_null($data)) {
138 return null;
139 }
140 $this->key = (string) $data;
141 }
142
143 return $this->key;
144 }
145
146
150 public function setName(?LocalizedString $name): void
151 {
152 $this->name = $name;
153 }
154
159 {
160 $this->description = $description;
161 }
162
167 {
168 $this->attributes = $attributes;
169 }
170
174 public function setKey(?string $key): void
175 {
176 $this->key = $key;
177 }
178}
__construct(?LocalizedString $name=null, ?LocalizedString $description=null, ?AttributeReferenceCollection $attributes=null, ?string $key=null)
static fromArray(array $data)