commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DuplicateAttributeValueErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'DuplicateAttributeValue';
29  protected $code;
30 
35  protected $message;
36 
41  protected $attribute;
42 
43 
47  public function __construct(
48  ?string $message = null,
49  ?Attribute $attribute = null,
50  ?string $code = null
51  ) {
52  $this->message = $message;
53  $this->attribute = $attribute;
54  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
55  }
56 
61  public function getCode()
62  {
63  if (is_null($this->code)) {
65  $data = $this->raw(self::FIELD_CODE);
66  if (is_null($data)) {
67  return null;
68  }
69  $this->code = (string) $data;
70  }
71 
72  return $this->code;
73  }
74 
79  public function getMessage()
80  {
81  if (is_null($this->message)) {
83  $data = $this->raw(self::FIELD_MESSAGE);
84  if (is_null($data)) {
85  return null;
86  }
87  $this->message = (string) $data;
88  }
89 
90  return $this->message;
91  }
92 
99  public function getAttribute()
100  {
101  if (is_null($this->attribute)) {
103  $data = $this->raw(self::FIELD_ATTRIBUTE);
104  if (is_null($data)) {
105  return null;
106  }
107  $className = AttributeModel::resolveDiscriminatorClass($data);
108  $this->attribute = $className::of($data);
109  }
110 
111  return $this->attribute;
112  }
113 
114 
118  public function setMessage(?string $message): void
119  {
120  $this->message = $message;
121  }
122 
126  public function setAttribute(?Attribute $attribute): void
127  {
128  $this->attribute = $attribute;
129  }
130 }
__construct(?string $message=null, ?Attribute $attribute=null, ?string $code=null)