commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssociateMissingPermissionErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
25 {
26  public const DISCRIMINATOR_VALUE = 'AssociateMissingPermission';
31  protected $code;
32 
37  protected $message;
38 
43  protected $associate;
44 
49  protected $businessUnit;
50 
55  protected $associateOnBehalf;
56 
61  protected $permissions;
62 
63 
67  public function __construct(
68  ?string $message = null,
72  ?array $permissions = null,
73  ?string $code = null
74  ) {
75  $this->message = $message;
76  $this->associate = $associate;
77  $this->businessUnit = $businessUnit;
78  $this->associateOnBehalf = $associateOnBehalf;
79  $this->permissions = $permissions;
80  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
81  }
82 
87  public function getCode()
88  {
89  if (is_null($this->code)) {
91  $data = $this->raw(self::FIELD_CODE);
92  if (is_null($data)) {
93  return null;
94  }
95  $this->code = (string) $data;
96  }
97 
98  return $this->code;
99  }
100 
111  public function getMessage()
112  {
113  if (is_null($this->message)) {
115  $data = $this->raw(self::FIELD_MESSAGE);
116  if (is_null($data)) {
117  return null;
118  }
119  $this->message = (string) $data;
120  }
121 
122  return $this->message;
123  }
124 
131  public function getAssociate()
132  {
133  if (is_null($this->associate)) {
135  $data = $this->raw(self::FIELD_ASSOCIATE);
136  if (is_null($data)) {
137  return null;
138  }
139 
140  $this->associate = CustomerResourceIdentifierModel::of($data);
141  }
142 
143  return $this->associate;
144  }
145 
152  public function getBusinessUnit()
153  {
154  if (is_null($this->businessUnit)) {
156  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
157  if (is_null($data)) {
158  return null;
159  }
160 
161  $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);
162  }
163 
164  return $this->businessUnit;
165  }
166 
173  public function getAssociateOnBehalf()
174  {
175  if (is_null($this->associateOnBehalf)) {
177  $data = $this->raw(self::FIELD_ASSOCIATE_ON_BEHALF);
178  if (is_null($data)) {
179  return null;
180  }
181 
182  $this->associateOnBehalf = CustomerResourceIdentifierModel::of($data);
183  }
184 
186  }
187 
194  public function getPermissions()
195  {
196  if (is_null($this->permissions)) {
198  $data = $this->raw(self::FIELD_PERMISSIONS);
199  if (is_null($data)) {
200  return null;
201  }
202  $this->permissions = $data;
203  }
204 
205  return $this->permissions;
206  }
207 
208 
212  public function setMessage(?string $message): void
213  {
214  $this->message = $message;
215  }
216 
221  {
222  $this->associate = $associate;
223  }
224 
229  {
230  $this->businessUnit = $businessUnit;
231  }
232 
237  {
238  $this->associateOnBehalf = $associateOnBehalf;
239  }
240 
244  public function setPermissions(?array $permissions): void
245  {
246  $this->permissions = $permissions;
247  }
248 
252  public function by(string $key)
253  {
254  $data = $this->raw($key);
255  if (is_null($data)) {
256  return null;
257  }
258 
259  return $data;
260  }
261 }
__construct(?string $message=null, ?CustomerResourceIdentifier $associate=null, ?BusinessUnitResourceIdentifier $businessUnit=null, ?CustomerResourceIdentifier $associateOnBehalf=null, ?array $permissions=null, ?string $code=null)