commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StateReferenceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class StateReferenceModel extends JsonObjectModel implements StateReference
23 {
24  public const DISCRIMINATOR_VALUE = 'state';
29  protected $typeId;
30 
35  protected $id;
36 
41  protected $obj;
42 
43 
47  public function __construct(
48  ?string $id = null,
49  ?State $obj = null,
50  ?string $typeId = null
51  ) {
52  $this->id = $id;
53  $this->obj = $obj;
54  $this->typeId = $typeId ?? self::DISCRIMINATOR_VALUE;
55  }
56 
63  public function getTypeId()
64  {
65  if (is_null($this->typeId)) {
67  $data = $this->raw(self::FIELD_TYPE_ID);
68  if (is_null($data)) {
69  return null;
70  }
71  $this->typeId = (string) $data;
72  }
73 
74  return $this->typeId;
75  }
76 
83  public function getId()
84  {
85  if (is_null($this->id)) {
87  $data = $this->raw(self::FIELD_ID);
88  if (is_null($data)) {
89  return null;
90  }
91  $this->id = (string) $data;
92  }
93 
94  return $this->id;
95  }
96 
103  public function getObj()
104  {
105  if (is_null($this->obj)) {
107  $data = $this->raw(self::FIELD_OBJ);
108  if (is_null($data)) {
109  return null;
110  }
111 
112  $this->obj = StateModel::of($data);
113  }
114 
115  return $this->obj;
116  }
117 
118 
122  public function setId(?string $id): void
123  {
124  $this->id = $id;
125  }
126 
130  public function setObj(?State $obj): void
131  {
132  $this->obj = $obj;
133  }
134 }
__construct(?string $id=null, ?State $obj=null, ?string $typeId=null)