commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductSearchResultModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $id;
29 
34  protected $productProjection;
35 
40  protected $matchingVariants;
41 
42 
46  public function __construct(
47  ?string $id = null,
50  ) {
51  $this->id = $id;
52  $this->productProjection = $productProjection;
53  $this->matchingVariants = $matchingVariants;
54  }
55 
62  public function getId()
63  {
64  if (is_null($this->id)) {
66  $data = $this->raw(self::FIELD_ID);
67  if (is_null($data)) {
68  return null;
69  }
70  $this->id = (string) $data;
71  }
72 
73  return $this->id;
74  }
75 
82  public function getProductProjection()
83  {
84  if (is_null($this->productProjection)) {
86  $data = $this->raw(self::FIELD_PRODUCT_PROJECTION);
87  if (is_null($data)) {
88  return null;
89  }
90 
91  $this->productProjection = ProductProjectionModel::of($data);
92  }
93 
95  }
96 
103  public function getMatchingVariants()
104  {
105  if (is_null($this->matchingVariants)) {
107  $data = $this->raw(self::FIELD_MATCHING_VARIANTS);
108  if (is_null($data)) {
109  return null;
110  }
111 
112  $this->matchingVariants = ProductSearchMatchingVariantsModel::of($data);
113  }
114 
116  }
117 
118 
122  public function setId(?string $id): void
123  {
124  $this->id = $id;
125  }
126 
131  {
132  $this->productProjection = $productProjection;
133  }
134 
139  {
140  $this->matchingVariants = $matchingVariants;
141  }
142 }
setMatchingVariants(?ProductSearchMatchingVariants $matchingVariants)
__construct(?string $id=null, ?ProductProjection $productProjection=null, ?ProductSearchMatchingVariants $matchingVariants=null)