|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file has been created by developers from BitBag. |
|
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
|
6
|
|
|
* another great project. |
|
7
|
|
|
* You can find more information about us on https://bitbag.io and write us |
|
8
|
|
|
* an email on [email protected]. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
declare(strict_types=1); |
|
12
|
|
|
|
|
13
|
|
|
namespace BitBag\SyliusVueStorefrontPlugin\Document\Product\ConfigurableOptions; |
|
14
|
|
|
|
|
15
|
|
|
class Option implements \JsonSerializable |
|
16
|
|
|
{ |
|
17
|
|
|
private const ID = 'id'; |
|
18
|
|
|
|
|
19
|
|
|
private const VALUES = 'values'; |
|
20
|
|
|
|
|
21
|
|
|
private const PRODUCT_ID = 'product_id'; |
|
22
|
|
|
|
|
23
|
|
|
private const LABEL = 'label'; |
|
24
|
|
|
|
|
25
|
|
|
private const POSITION = 'position'; |
|
26
|
|
|
|
|
27
|
|
|
private const ATTRIBUTE_ID = 'attribute_id'; |
|
28
|
|
|
|
|
29
|
|
|
private const ATTRIBUTE_CODE = 'attribute_code'; |
|
30
|
|
|
|
|
31
|
|
|
/** @var int */ |
|
32
|
|
|
private $id; |
|
33
|
|
|
|
|
34
|
|
|
/** @var OptionValue[] */ |
|
35
|
|
|
private $values; |
|
36
|
|
|
|
|
37
|
|
|
/** @var int */ |
|
38
|
|
|
private $productId; |
|
39
|
|
|
|
|
40
|
|
|
/** @var string */ |
|
41
|
|
|
private $label; |
|
42
|
|
|
|
|
43
|
|
|
/** @var int */ |
|
44
|
|
|
private $position; |
|
45
|
|
|
|
|
46
|
|
|
/** @var int */ |
|
47
|
|
|
private $attributeId; |
|
48
|
|
|
|
|
49
|
|
|
/** @var string */ |
|
50
|
|
|
private $attributeCode; |
|
51
|
|
|
|
|
52
|
|
|
public function __construct( |
|
53
|
|
|
int $id, |
|
54
|
|
|
array $values, |
|
55
|
|
|
int $productId, |
|
56
|
|
|
string $label, |
|
57
|
|
|
int $position, |
|
58
|
|
|
int $attributeId, |
|
59
|
|
|
string $attributeCode |
|
60
|
|
|
) { |
|
61
|
|
|
$this->id = $id; |
|
62
|
|
|
$this->values = $values; |
|
63
|
|
|
$this->productId = $productId; |
|
64
|
|
|
$this->label = $label; |
|
65
|
|
|
$this->position = $position; |
|
66
|
|
|
$this->attributeId = $attributeId; |
|
67
|
|
|
$this->attributeCode = $attributeCode; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function jsonSerialize(): array |
|
71
|
|
|
{ |
|
72
|
|
|
return [ |
|
73
|
|
|
self::ID => $this->id, |
|
74
|
|
|
self::VALUES => $this->values, |
|
75
|
|
|
self::PRODUCT_ID => $this->productId, |
|
76
|
|
|
self::LABEL => $this->label, |
|
77
|
|
|
self::POSITION => $this->position, |
|
78
|
|
|
self::ATTRIBUTE_ID => (string) $this->attributeId, |
|
79
|
|
|
self::ATTRIBUTE_CODE => $this->attributeCode, |
|
80
|
|
|
]; |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|