commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AttributeNestedTypeModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'nested';
29  protected $name;
30 
35  protected $typeReference;
36 
37 
41  public function __construct(
43  ?string $name = null
44  ) {
45  $this->typeReference = $typeReference;
46  $this->name = $name ?? self::DISCRIMINATOR_VALUE;
47  }
48 
53  public function getName()
54  {
55  if (is_null($this->name)) {
57  $data = $this->raw(self::FIELD_NAME);
58  if (is_null($data)) {
59  return null;
60  }
61  $this->name = (string) $data;
62  }
63 
64  return $this->name;
65  }
66 
73  public function getTypeReference()
74  {
75  if (is_null($this->typeReference)) {
77  $data = $this->raw(self::FIELD_TYPE_REFERENCE);
78  if (is_null($data)) {
79  return null;
80  }
81 
82  $this->typeReference = ProductTypeKeyReferenceModel::of($data);
83  }
84 
85  return $this->typeReference;
86  }
87 
88 
93  {
94  $this->typeReference = $typeReference;
95  }
96 }
__construct(?ProductTypeKeyReference $typeReference=null, ?string $name=null)