1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mapado\RestClientSdk\Tests\Model\JsonLd; |
4
|
|
|
|
5
|
|
|
use DateTime; |
6
|
|
|
use Mapado\RestClientSdk\Mapping\Annotations as Rest; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class CartItem |
10
|
|
|
* @author Julien Deniau <[email protected]> |
11
|
|
|
* |
12
|
|
|
* @Rest\Entity(key="cart_item") |
13
|
|
|
*/ |
14
|
|
|
class CartItem |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* id |
18
|
|
|
* |
19
|
|
|
* @var mixed |
20
|
|
|
* @access private |
21
|
|
|
* |
22
|
|
|
* @Rest\Id |
23
|
|
|
* @Rest\Attribute(name="id", type="string") |
24
|
|
|
*/ |
25
|
|
|
private $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* amount |
29
|
|
|
* |
30
|
|
|
* @var mixed |
31
|
|
|
* @access private |
32
|
|
|
* |
33
|
|
|
* @Rest\Attribute(name="amount", type="float") |
34
|
|
|
*/ |
35
|
|
|
private $amount; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* createdAt |
39
|
|
|
* |
40
|
|
|
* @var mixed |
41
|
|
|
* @access private |
42
|
|
|
* |
43
|
|
|
* @Rest\Attribute(name="created_at", type="datetime") |
44
|
|
|
*/ |
45
|
|
|
private $createdAt; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* data |
49
|
|
|
* |
50
|
|
|
* @var mixed |
51
|
|
|
* @access private |
52
|
|
|
* |
53
|
|
|
* @Rest\Attribute(name="data", type="array") |
54
|
|
|
*/ |
55
|
|
|
private $data = []; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* cart |
59
|
|
|
* |
60
|
|
|
* @var mixed |
61
|
|
|
* @access private |
62
|
|
|
* |
63
|
|
|
* @Rest\ManyToOne(name="cart", targetEntity="Cart") |
64
|
|
|
*/ |
65
|
|
|
private $cart; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* product |
69
|
|
|
* |
70
|
|
|
* @var mixed |
71
|
|
|
* @access private |
72
|
|
|
*/ |
73
|
|
|
private $product; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* cartItemDetailList |
77
|
|
|
* |
78
|
|
|
* @var mixed |
79
|
|
|
* @access private |
80
|
|
|
*/ |
81
|
|
|
private $cartItemDetailList = []; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Getter for id |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getId() |
89
|
|
|
{ |
90
|
|
|
return $this->id; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Setter for id |
95
|
|
|
* |
96
|
|
|
* @param string $id |
97
|
|
|
* @return CartItem |
98
|
|
|
*/ |
99
|
|
|
public function setId($id) |
100
|
|
|
{ |
101
|
|
|
$this->id = $id; |
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Getter for amount |
107
|
|
|
* |
108
|
|
|
* @return float |
109
|
|
|
*/ |
110
|
|
|
public function getAmount() |
111
|
|
|
{ |
112
|
|
|
return $this->amount; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Setter for amount |
117
|
|
|
* |
118
|
|
|
* @param float $amount |
119
|
|
|
* @return CartItem |
120
|
|
|
*/ |
121
|
|
|
public function setAmount($amount) |
122
|
|
|
{ |
123
|
|
|
$this->amount = $amount; |
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Getter for createdAt |
129
|
|
|
* |
130
|
|
|
* @return DateTime |
131
|
|
|
*/ |
132
|
|
|
public function getCreatedAt() |
133
|
|
|
{ |
134
|
|
|
return $this->createdAt; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Setter for createdAt |
139
|
|
|
* |
140
|
|
|
* @param DateTime $createdAt |
141
|
|
|
* @return CartItem |
142
|
|
|
*/ |
143
|
|
|
public function setCreatedAt(DateTime $createdAt) |
144
|
|
|
{ |
145
|
|
|
$this->createdAt = $createdAt; |
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Getter for data |
151
|
|
|
* |
152
|
|
|
* @return array |
153
|
|
|
*/ |
154
|
|
|
public function getData() |
155
|
|
|
{ |
156
|
|
|
return $this->data; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Setter for data |
161
|
|
|
* |
162
|
|
|
* @param array $data |
163
|
|
|
* @return CartItem |
164
|
|
|
*/ |
165
|
|
|
public function setData(array $data) |
166
|
|
|
{ |
167
|
|
|
$this->data = $data; |
168
|
|
|
return $this; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* Getter for cart |
173
|
|
|
* |
174
|
|
|
* @return Cart |
175
|
|
|
*/ |
176
|
|
|
public function getCart() |
177
|
|
|
{ |
178
|
|
|
return $this->cart; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Setter for cart |
183
|
|
|
* |
184
|
|
|
* @param Cart $cart |
185
|
|
|
* @return CartItem |
186
|
|
|
*/ |
187
|
|
|
public function setCart(Cart $cart) |
188
|
|
|
{ |
189
|
|
|
$this->cart = $cart; |
190
|
|
|
$this->cart->addCartItemList($this); |
191
|
|
|
|
192
|
|
|
return $this; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* Getter for product |
197
|
|
|
* |
198
|
|
|
* @return Product |
199
|
|
|
*/ |
200
|
|
|
public function getProduct() |
201
|
|
|
{ |
202
|
|
|
return $this->product; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Setter for product |
207
|
|
|
* |
208
|
|
|
* @param Product $product |
209
|
|
|
* @return CartItem |
210
|
|
|
*/ |
211
|
|
|
public function setProduct(Product $product) |
212
|
|
|
{ |
213
|
|
|
$this->product = $product; |
214
|
|
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Getter for cartItemDetailList |
219
|
|
|
* |
220
|
|
|
* @return array |
221
|
|
|
*/ |
222
|
|
|
public function getCartItemDetailList() |
223
|
|
|
{ |
224
|
|
|
return $this->cartItemDetailList; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Setter for cartItemDetailList |
229
|
|
|
* |
230
|
|
|
* @param array $cartItemDetailList |
231
|
|
|
* @return CartItem |
232
|
|
|
*/ |
233
|
|
|
public function setCartItemDetailList(array $cartItemDetailList) |
234
|
|
|
{ |
235
|
|
|
$this->cartItemDetailList = $cartItemDetailList; |
236
|
|
|
return $this; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
public function addCartItemDetailList($itemDetail) |
240
|
|
|
{ |
241
|
|
|
$this->cartItemDetailList[] = $itemDetail; |
242
|
|
|
return $this; |
243
|
|
|
} |
244
|
|
|
} |
245
|
|
|
|