1 | <?php |
||
9 | class Product implements JsonSerializable |
||
10 | { |
||
11 | private $id; |
||
12 | private $images; |
||
13 | private $variants; |
||
14 | private $name; |
||
15 | private $description; |
||
16 | private $notes; |
||
17 | private $creation_datetime; |
||
18 | private $modification_datetime; |
||
19 | |||
20 | 1 | public function __construct() |
|
21 | { |
||
22 | 1 | $this->variants = new Variants(); |
|
23 | 1 | } |
|
24 | |||
25 | 1 | public function getId(): ?int |
|
26 | { |
||
27 | 1 | return $this->id; |
|
28 | } |
||
29 | |||
30 | 1 | public function setId(int $id = null) |
|
31 | { |
||
32 | 1 | $this->id = $id; |
|
33 | 1 | } |
|
34 | |||
35 | public function getImages(): ?array |
||
39 | |||
40 | 1 | public function setImages(array $images = null) |
|
41 | { |
||
42 | 1 | $this->images = $images; |
|
43 | 1 | } |
|
44 | |||
45 | 1 | public function getVariants(): ?Variants |
|
46 | { |
||
47 | 1 | return $this->variants; |
|
48 | } |
||
49 | |||
50 | 1 | public function setVariants(Variants $variants) |
|
51 | { |
||
52 | 1 | $this->variants = $variants; |
|
53 | 1 | } |
|
54 | |||
55 | 1 | public function getName(): ?string |
|
56 | { |
||
57 | 1 | return $this->name; |
|
58 | } |
||
59 | |||
60 | 1 | public function setName(string $name = null) |
|
61 | { |
||
62 | 1 | $this->name = $name; |
|
63 | 1 | } |
|
64 | |||
65 | 1 | public function getDescription(): ?string |
|
66 | { |
||
67 | 1 | return $this->description; |
|
68 | } |
||
69 | |||
70 | 1 | public function setDescription(string $description = null) |
|
71 | { |
||
72 | 1 | $this->description = $description; |
|
73 | 1 | } |
|
74 | |||
75 | 1 | public function getNotes(): ?string |
|
76 | { |
||
77 | 1 | return $this->notes; |
|
78 | } |
||
79 | |||
80 | 1 | public function setNotes(string $notes = null) |
|
81 | { |
||
82 | 1 | $this->notes = $notes; |
|
83 | 1 | } |
|
84 | |||
85 | public function getCreationDatetime(): ?DateTime |
||
89 | |||
90 | 1 | public function setCreationDatetime(DateTime $creation_datetime = null) |
|
91 | { |
||
92 | 1 | $this->creation_datetime = $creation_datetime; |
|
93 | 1 | } |
|
94 | |||
95 | public function getModificationDatetime(): ?DateTime |
||
99 | |||
100 | 1 | public function setModificationDatetime(DateTime $modification_datetime = null) |
|
101 | { |
||
102 | 1 | $this->modification_datetime = $modification_datetime; |
|
103 | 1 | } |
|
104 | |||
105 | 1 | public function jsonSerialize() |
|
106 | { |
||
107 | $returnValue = [ |
||
108 | 1 | 'variants' => $this->getVariants()->jsonSerialize(), |
|
109 | 1 | 'name' => $this->getName(), |
|
|
|||
110 | 1 | 'description' => $this->getDescription(), |
|
111 | 1 | 'notes' => $this->getNotes(), |
|
112 | ]; |
||
113 | //if ($this->getImages() instanceof NewImage) { |
||
118 | } |
||
119 |