commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssociateRoleDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $key;
29 
34  protected $name;
35 
40  protected $buyerAssignable;
41 
46  protected $permissions;
47 
52  protected $custom;
53 
54 
58  public function __construct(
59  ?string $key = null,
60  ?string $name = null,
61  ?bool $buyerAssignable = null,
62  ?array $permissions = null,
64  ) {
65  $this->key = $key;
66  $this->name = $name;
67  $this->buyerAssignable = $buyerAssignable;
68  $this->permissions = $permissions;
69  $this->custom = $custom;
70  }
71 
78  public function getKey()
79  {
80  if (is_null($this->key)) {
82  $data = $this->raw(self::FIELD_KEY);
83  if (is_null($data)) {
84  return null;
85  }
86  $this->key = (string) $data;
87  }
88 
89  return $this->key;
90  }
91 
98  public function getName()
99  {
100  if (is_null($this->name)) {
102  $data = $this->raw(self::FIELD_NAME);
103  if (is_null($data)) {
104  return null;
105  }
106  $this->name = (string) $data;
107  }
108 
109  return $this->name;
110  }
111 
118  public function getBuyerAssignable()
119  {
120  if (is_null($this->buyerAssignable)) {
122  $data = $this->raw(self::FIELD_BUYER_ASSIGNABLE);
123  if (is_null($data)) {
124  return null;
125  }
126  $this->buyerAssignable = (bool) $data;
127  }
128 
129  return $this->buyerAssignable;
130  }
131 
138  public function getPermissions()
139  {
140  if (is_null($this->permissions)) {
142  $data = $this->raw(self::FIELD_PERMISSIONS);
143  if (is_null($data)) {
144  return null;
145  }
146  $this->permissions = $data;
147  }
148 
149  return $this->permissions;
150  }
151 
158  public function getCustom()
159  {
160  if (is_null($this->custom)) {
162  $data = $this->raw(self::FIELD_CUSTOM);
163  if (is_null($data)) {
164  return null;
165  }
166 
167  $this->custom = CustomFieldsDraftModel::of($data);
168  }
169 
170  return $this->custom;
171  }
172 
173 
177  public function setKey(?string $key): void
178  {
179  $this->key = $key;
180  }
181 
185  public function setName(?string $name): void
186  {
187  $this->name = $name;
188  }
189 
193  public function setBuyerAssignable(?bool $buyerAssignable): void
194  {
195  $this->buyerAssignable = $buyerAssignable;
196  }
197 
201  public function setPermissions(?array $permissions): void
202  {
203  $this->permissions = $permissions;
204  }
205 
209  public function setCustom(?CustomFieldsDraft $custom): void
210  {
211  $this->custom = $custom;
212  }
213 }
__construct(?string $key=null, ?string $name=null, ?bool $buyerAssignable=null, ?array $permissions=null, ?CustomFieldsDraft $custom=null)