|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Oro\Bundle\MagentoBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
6
|
|
|
use Doctrine\Common\Collections\Collection; |
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
|
|
9
|
|
|
use Oro\Bundle\OrganizationBundle\Entity\Organization; |
|
10
|
|
|
use Oro\Bundle\UserBundle\Entity\User; |
|
11
|
|
|
use Oro\Bundle\LocaleBundle\Model\FirstNameInterface; |
|
12
|
|
|
use Oro\Bundle\LocaleBundle\Model\LastNameInterface; |
|
13
|
|
|
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config; |
|
14
|
|
|
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField; |
|
15
|
|
|
use Oro\Bundle\MagentoBundle\Model\ExtendCart; |
|
16
|
|
|
use Oro\Bundle\SalesBundle\Entity\Opportunity; |
|
17
|
|
|
use Oro\Bundle\ChannelBundle\Model\ChannelAwareInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @SuppressWarnings(PHPMD.ExcessivePublicCount) |
|
21
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
|
22
|
|
|
* @SuppressWarnings(PHPMD.TooManyFields) |
|
23
|
|
|
* |
|
24
|
|
|
* @package Oro\Bundle\OroMagentoBundle\Entity |
|
25
|
|
|
* @ORM\Entity(repositoryClass="Oro\Bundle\MagentoBundle\Entity\Repository\CartRepository") |
|
26
|
|
|
* @ORM\HasLifecycleCallbacks |
|
27
|
|
|
* @ORM\Table(name="orocrm_magento_cart", |
|
28
|
|
|
* indexes={ |
|
29
|
|
|
* @ORM\Index(name="magecart_origin_idx", columns={"origin_id"}), |
|
30
|
|
|
* @ORM\Index(name="magecart_updated_idx",columns={"updatedAt"}) |
|
31
|
|
|
* }, |
|
32
|
|
|
* uniqueConstraints={ |
|
33
|
|
|
* @ORM\UniqueConstraint(name="unq_cart_origin_id_channel_id", columns={"origin_id", "channel_id"}) |
|
34
|
|
|
* } |
|
35
|
|
|
* ) |
|
36
|
|
|
* @Config( |
|
37
|
|
|
* routeView="oro_magento_cart_view", |
|
38
|
|
|
* defaultValues={ |
|
39
|
|
|
* "entity"={ |
|
40
|
|
|
* "icon"="icon-shopping-cart" |
|
41
|
|
|
* }, |
|
42
|
|
|
* "ownership"={ |
|
43
|
|
|
* "owner_type"="USER", |
|
44
|
|
|
* "owner_field_name"="owner", |
|
45
|
|
|
* "owner_column_name"="user_owner_id", |
|
46
|
|
|
* "organization_field_name"="organization", |
|
47
|
|
|
* "organization_column_name"="organization_id" |
|
48
|
|
|
* }, |
|
49
|
|
|
* "security"={ |
|
50
|
|
|
* "type"="ACL", |
|
51
|
|
|
* "group_name"="", |
|
52
|
|
|
* "category"="sales_data" |
|
53
|
|
|
* }, |
|
54
|
|
|
* "form"={ |
|
55
|
|
|
* "grid_name"="magento-cart-grid", |
|
56
|
|
|
* }, |
|
57
|
|
|
* "grid"={ |
|
58
|
|
|
* "default"="magento-cart-grid", |
|
59
|
|
|
* "context"="magento-cart-for-context-grid" |
|
60
|
|
|
* }, |
|
61
|
|
|
* "tag"={ |
|
62
|
|
|
* "enabled"=true |
|
63
|
|
|
* } |
|
64
|
|
|
* } |
|
65
|
|
|
* ) |
|
66
|
|
|
*/ |
|
67
|
|
|
class Cart extends ExtendCart implements |
|
68
|
|
|
ChannelAwareInterface, |
|
69
|
|
|
FirstNameInterface, |
|
70
|
|
|
LastNameInterface, |
|
71
|
|
|
OriginAwareInterface, |
|
72
|
|
|
IntegrationAwareInterface |
|
73
|
|
|
{ |
|
74
|
|
|
use IntegrationEntityTrait, OriginTrait, NamesAwareTrait, ChannelEntityTrait; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @var CartItem[]|Collection |
|
78
|
|
|
* |
|
79
|
|
|
* @ORM\OneToMany(targetEntity="Oro\Bundle\MagentoBundle\Entity\CartItem", |
|
80
|
|
|
* mappedBy="cart", cascade={"all"}, orphanRemoval=true |
|
81
|
|
|
* ) |
|
82
|
|
|
* @ORM\OrderBy({"originId" = "DESC"}) |
|
83
|
|
|
* @ConfigField( |
|
84
|
|
|
* defaultValues={ |
|
85
|
|
|
* "importexport"={ |
|
86
|
|
|
* "full"=true |
|
87
|
|
|
* } |
|
88
|
|
|
* } |
|
89
|
|
|
* ) |
|
90
|
|
|
*/ |
|
91
|
|
|
protected $cartItems; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="carts") |
|
95
|
|
|
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", onDelete="CASCADE") |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $customer; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var Store |
|
101
|
|
|
* |
|
102
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\MagentoBundle\Entity\Store") |
|
103
|
|
|
* @ORM\JoinColumn(name="store_id", referencedColumnName="id", onDelete="SET NULL") |
|
104
|
|
|
* @ConfigField( |
|
105
|
|
|
* defaultValues={ |
|
106
|
|
|
* "importexport"={ |
|
107
|
|
|
* "full"=false |
|
108
|
|
|
* } |
|
109
|
|
|
* } |
|
110
|
|
|
* ) |
|
111
|
|
|
*/ |
|
112
|
|
|
protected $store; |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Total items qty |
|
116
|
|
|
* |
|
117
|
|
|
* @var float |
|
118
|
|
|
* |
|
119
|
|
|
* @ORM\Column(name="items_qty", type="float") |
|
120
|
|
|
*/ |
|
121
|
|
|
protected $itemsQty; |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Items count |
|
125
|
|
|
* |
|
126
|
|
|
* @var integer |
|
127
|
|
|
* |
|
128
|
|
|
* @ORM\Column(name="items_count", type="integer", options={"unsigned"=true}) |
|
129
|
|
|
*/ |
|
130
|
|
|
protected $itemsCount; |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @var string |
|
134
|
|
|
* |
|
135
|
|
|
* @ORM\Column(name="base_currency_code", type="string", length=32, nullable=false) |
|
136
|
|
|
*/ |
|
137
|
|
|
protected $baseCurrencyCode; |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @var string |
|
141
|
|
|
* |
|
142
|
|
|
* @ORM\Column(name="store_currency_code", type="string", length=32, nullable=false) |
|
143
|
|
|
*/ |
|
144
|
|
|
protected $storeCurrencyCode; |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @var string |
|
148
|
|
|
* |
|
149
|
|
|
* @ORM\Column(name="quote_currency_code", type="string", length=32, nullable=false) |
|
150
|
|
|
*/ |
|
151
|
|
|
protected $quoteCurrencyCode; |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @var float |
|
155
|
|
|
* |
|
156
|
|
|
* @ORM\Column(name="store_to_base_rate", type="float", nullable=false) |
|
157
|
|
|
*/ |
|
158
|
|
|
protected $storeToBaseRate; |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @var float |
|
162
|
|
|
* |
|
163
|
|
|
* @ORM\Column(name="store_to_quote_rate", type="float", nullable=true) |
|
164
|
|
|
*/ |
|
165
|
|
|
protected $storeToQuoteRate; |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @var string |
|
169
|
|
|
* |
|
170
|
|
|
* @ORM\Column(name="email", type="string", length=255, nullable=true) |
|
171
|
|
|
* @ConfigField( |
|
172
|
|
|
* defaultValues={ |
|
173
|
|
|
* "entity"={ |
|
174
|
|
|
* "contact_information"="email" |
|
175
|
|
|
* } |
|
176
|
|
|
* } |
|
177
|
|
|
* ) |
|
178
|
|
|
*/ |
|
179
|
|
|
protected $email; |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @var string |
|
183
|
|
|
* |
|
184
|
|
|
* @ORM\Column(name="gift_message", type="string", length=255, nullable=true) |
|
185
|
|
|
*/ |
|
186
|
|
|
protected $giftMessage; |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @var float |
|
190
|
|
|
* |
|
191
|
|
|
* @ORM\Column(name="is_guest", type="boolean") |
|
192
|
|
|
*/ |
|
193
|
|
|
protected $isGuest; |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @var CartAddress $shippingAddress |
|
197
|
|
|
* |
|
198
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\MagentoBundle\Entity\CartAddress", cascade={"persist", "remove"}) |
|
199
|
|
|
* @ORM\JoinColumn(name="shipping_address_id", referencedColumnName="id", onDelete="SET NULL") |
|
200
|
|
|
* @ConfigField( |
|
201
|
|
|
* defaultValues={ |
|
202
|
|
|
* "importexport"={ |
|
203
|
|
|
* "full"=true |
|
204
|
|
|
* } |
|
205
|
|
|
* } |
|
206
|
|
|
* ) |
|
207
|
|
|
*/ |
|
208
|
|
|
protected $shippingAddress; |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @var CartAddress $billingAddress |
|
212
|
|
|
* |
|
213
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\MagentoBundle\Entity\CartAddress", cascade={"persist", "remove"}) |
|
214
|
|
|
* @ORM\JoinColumn(name="billing_address_id", referencedColumnName="id", onDelete="SET NULL") |
|
215
|
|
|
* @ConfigField( |
|
216
|
|
|
* defaultValues={ |
|
217
|
|
|
* "importexport"={ |
|
218
|
|
|
* "full"=true |
|
219
|
|
|
* } |
|
220
|
|
|
* } |
|
221
|
|
|
* ) |
|
222
|
|
|
*/ |
|
223
|
|
|
protected $billingAddress; |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* @var string |
|
227
|
|
|
* |
|
228
|
|
|
* @ORM\Column(name="payment_details", type="string", length=255, nullable=true) |
|
229
|
|
|
*/ |
|
230
|
|
|
protected $paymentDetails; |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @var CartStatus |
|
234
|
|
|
* |
|
235
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\MagentoBundle\Entity\CartStatus") |
|
236
|
|
|
* @ORM\JoinColumn(name="status_name", referencedColumnName="name", onDelete="SET NULL") |
|
237
|
|
|
* @ConfigField( |
|
238
|
|
|
* defaultValues={ |
|
239
|
|
|
* "importexport"={ |
|
240
|
|
|
* "full"=false |
|
241
|
|
|
* } |
|
242
|
|
|
* } |
|
243
|
|
|
* ) |
|
244
|
|
|
*/ |
|
245
|
|
|
protected $status; |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @var Opportunity |
|
249
|
|
|
* |
|
250
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\SalesBundle\Entity\Opportunity") |
|
251
|
|
|
* @ORM\JoinColumn(name="opportunity_id", referencedColumnName="id", onDelete="SET NULL") |
|
252
|
|
|
*/ |
|
253
|
|
|
protected $opportunity; |
|
254
|
|
|
|
|
255
|
|
|
/** |
|
256
|
|
|
* @var string |
|
257
|
|
|
* |
|
258
|
|
|
* @ORM\Column(name="notes", type="text", nullable=true) |
|
259
|
|
|
*/ |
|
260
|
|
|
protected $notes; |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* @var string |
|
264
|
|
|
* |
|
265
|
|
|
* @ORM\Column(name="status_message", type="string", length=255, nullable=true) |
|
266
|
|
|
*/ |
|
267
|
|
|
protected $statusMessage; |
|
268
|
|
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* @var User |
|
271
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\UserBundle\Entity\User") |
|
272
|
|
|
* @ORM\JoinColumn(name="user_owner_id", referencedColumnName="id", onDelete="SET NULL") |
|
273
|
|
|
*/ |
|
274
|
|
|
protected $owner; |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @var Organization |
|
278
|
|
|
* |
|
279
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization") |
|
280
|
|
|
* @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") |
|
281
|
|
|
*/ |
|
282
|
|
|
protected $organization; |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* @var \DateTime |
|
286
|
|
|
* |
|
287
|
|
|
* @ORM\Column(type="datetime", name="imported_at", nullable=true) |
|
288
|
|
|
*/ |
|
289
|
|
|
protected $importedAt; |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* @var \DateTime |
|
293
|
|
|
* |
|
294
|
|
|
* @ORM\Column(type="datetime", name="synced_at", nullable=true) |
|
295
|
|
|
*/ |
|
296
|
|
|
protected $syncedAt; |
|
297
|
|
|
|
|
298
|
|
|
public function __construct() |
|
299
|
|
|
{ |
|
300
|
|
|
parent::__construct(); |
|
301
|
|
|
|
|
302
|
|
|
$this->status = new CartStatus('open'); |
|
303
|
|
|
$this->cartItems = new ArrayCollection(); |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
/** |
|
307
|
|
|
* @return CartItem[]|Collection |
|
308
|
|
|
*/ |
|
309
|
|
|
public function getCartItems() |
|
310
|
|
|
{ |
|
311
|
|
|
return $this->cartItems; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* @param CartItem[]|Collection $cartItems |
|
316
|
|
|
*/ |
|
317
|
|
|
public function setCartItems(Collection $cartItems) |
|
318
|
|
|
{ |
|
319
|
|
|
$this->cartItems = $cartItems; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
/** |
|
323
|
|
|
* @param CartItem $cartItem |
|
324
|
|
|
* |
|
325
|
|
|
* @return $this |
|
326
|
|
|
*/ |
|
327
|
|
|
public function addCartItem(CartItem $cartItem) |
|
328
|
|
|
{ |
|
329
|
|
|
if (!$this->cartItems->contains($cartItem)) { |
|
330
|
|
|
$this->cartItems->add($cartItem); |
|
331
|
|
|
$cartItem->setCart($this); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
return $this; |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* @param CartItem $cartItem |
|
339
|
|
|
* |
|
340
|
|
|
* @return $this |
|
341
|
|
|
*/ |
|
342
|
|
|
public function removeCartItem(CartItem $cartItem) |
|
343
|
|
|
{ |
|
344
|
|
|
if ($this->cartItems->contains($cartItem)) { |
|
345
|
|
|
$this->cartItems->removeElement($cartItem); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
return $this; |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* @param Store $store |
|
353
|
|
|
*/ |
|
354
|
|
|
public function setStore($store) |
|
355
|
|
|
{ |
|
356
|
|
|
$this->store = $store; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* @return Store |
|
361
|
|
|
*/ |
|
362
|
|
|
public function getStore() |
|
363
|
|
|
{ |
|
364
|
|
|
return $this->store; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
/** |
|
368
|
|
|
* @return Customer |
|
369
|
|
|
*/ |
|
370
|
|
|
public function getCustomer() |
|
371
|
|
|
{ |
|
372
|
|
|
return $this->customer; |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
/** |
|
376
|
|
|
* @param Customer|null $customer |
|
377
|
|
|
* |
|
378
|
|
|
* @return Cart |
|
379
|
|
|
*/ |
|
380
|
|
|
public function setCustomer(Customer $customer = null) |
|
381
|
|
|
{ |
|
382
|
|
|
$this->customer = $customer; |
|
383
|
|
|
|
|
384
|
|
|
return $this; |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
/** |
|
388
|
|
|
* @param CartAddress $shippingAddress |
|
389
|
|
|
* |
|
390
|
|
|
* @return Cart |
|
391
|
|
|
*/ |
|
392
|
|
|
public function setShippingAddress(CartAddress $shippingAddress = null) |
|
393
|
|
|
{ |
|
394
|
|
|
$this->shippingAddress = $shippingAddress; |
|
395
|
|
|
|
|
396
|
|
|
return $this; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
/** |
|
400
|
|
|
* @param CartAddress $billingAddress |
|
401
|
|
|
* |
|
402
|
|
|
* @return Cart |
|
403
|
|
|
*/ |
|
404
|
|
|
public function setBillingAddress(CartAddress $billingAddress = null) |
|
405
|
|
|
{ |
|
406
|
|
|
$this->billingAddress = $billingAddress; |
|
407
|
|
|
|
|
408
|
|
|
return $this; |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* @return CartAddress |
|
413
|
|
|
*/ |
|
414
|
|
|
public function getBillingAddress() |
|
415
|
|
|
{ |
|
416
|
|
|
return $this->billingAddress; |
|
417
|
|
|
} |
|
418
|
|
|
|
|
419
|
|
|
/** |
|
420
|
|
|
* @return CartAddress |
|
421
|
|
|
*/ |
|
422
|
|
|
public function getShippingAddress() |
|
423
|
|
|
{ |
|
424
|
|
|
return $this->shippingAddress; |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
/** |
|
428
|
|
|
* @return string |
|
429
|
|
|
*/ |
|
430
|
|
|
public function getEmail() |
|
431
|
|
|
{ |
|
432
|
|
|
return $this->email; |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
/** |
|
436
|
|
|
* @param string $email |
|
437
|
|
|
* |
|
438
|
|
|
* @return Cart |
|
439
|
|
|
*/ |
|
440
|
|
|
public function setEmail($email) |
|
441
|
|
|
{ |
|
442
|
|
|
$this->email = $email; |
|
443
|
|
|
|
|
444
|
|
|
return $this; |
|
445
|
|
|
} |
|
446
|
|
|
|
|
447
|
|
|
/** |
|
448
|
|
|
* @return float |
|
449
|
|
|
*/ |
|
450
|
|
|
public function getItemsQty() |
|
451
|
|
|
{ |
|
452
|
|
|
return $this->itemsQty; |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
/** |
|
456
|
|
|
* @param float $itemsQty |
|
457
|
|
|
* |
|
458
|
|
|
* @return Cart |
|
459
|
|
|
*/ |
|
460
|
|
|
public function setItemsQty($itemsQty) |
|
461
|
|
|
{ |
|
462
|
|
|
$this->itemsQty = $itemsQty; |
|
463
|
|
|
|
|
464
|
|
|
return $this; |
|
465
|
|
|
} |
|
466
|
|
|
|
|
467
|
|
|
/** |
|
468
|
|
|
* @return float |
|
469
|
|
|
*/ |
|
470
|
|
|
public function getSubTotal() |
|
471
|
|
|
{ |
|
472
|
|
|
return $this->subTotal; |
|
473
|
|
|
} |
|
474
|
|
|
|
|
475
|
|
|
/** |
|
476
|
|
|
* @return string |
|
477
|
|
|
*/ |
|
478
|
|
|
public function getQuoteCurrencyCode() |
|
479
|
|
|
{ |
|
480
|
|
|
return $this->quoteCurrencyCode; |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
/** |
|
484
|
|
|
* @param string $quoteCurrencyCode |
|
485
|
|
|
* |
|
486
|
|
|
* @return Cart |
|
487
|
|
|
*/ |
|
488
|
|
|
public function setQuoteCurrencyCode($quoteCurrencyCode) |
|
489
|
|
|
{ |
|
490
|
|
|
$this->quoteCurrencyCode = $quoteCurrencyCode; |
|
491
|
|
|
|
|
492
|
|
|
return $this; |
|
493
|
|
|
} |
|
494
|
|
|
|
|
495
|
|
|
/** |
|
496
|
|
|
* @param string $paymentDetails |
|
497
|
|
|
*/ |
|
498
|
|
|
public function setPaymentDetails($paymentDetails) |
|
499
|
|
|
{ |
|
500
|
|
|
$this->paymentDetails = $paymentDetails; |
|
501
|
|
|
} |
|
502
|
|
|
|
|
503
|
|
|
/** |
|
504
|
|
|
* @return string |
|
505
|
|
|
*/ |
|
506
|
|
|
public function getPaymentDetails() |
|
507
|
|
|
{ |
|
508
|
|
|
return $this->paymentDetails; |
|
509
|
|
|
} |
|
510
|
|
|
|
|
511
|
|
|
/** |
|
512
|
|
|
* @param CartStatus $status |
|
513
|
|
|
* |
|
514
|
|
|
* @return Cart |
|
515
|
|
|
*/ |
|
516
|
|
|
public function setStatus($status) |
|
517
|
|
|
{ |
|
518
|
|
|
$this->status = $status; |
|
519
|
|
|
|
|
520
|
|
|
return $this; |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* @return CartStatus |
|
525
|
|
|
*/ |
|
526
|
|
|
public function getStatus() |
|
527
|
|
|
{ |
|
528
|
|
|
return $this->status; |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
/** |
|
532
|
|
|
* @param string $baseCurrencyCode |
|
533
|
|
|
* |
|
534
|
|
|
* @return Cart |
|
535
|
|
|
*/ |
|
536
|
|
|
public function setBaseCurrencyCode($baseCurrencyCode) |
|
537
|
|
|
{ |
|
538
|
|
|
$this->baseCurrencyCode = $baseCurrencyCode; |
|
539
|
|
|
|
|
540
|
|
|
return $this; |
|
541
|
|
|
} |
|
542
|
|
|
|
|
543
|
|
|
/** |
|
544
|
|
|
* @return string |
|
545
|
|
|
*/ |
|
546
|
|
|
public function getBaseCurrencyCode() |
|
547
|
|
|
{ |
|
548
|
|
|
return $this->baseCurrencyCode; |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
/** |
|
552
|
|
|
* @param string $giftMessage |
|
553
|
|
|
* |
|
554
|
|
|
* @return Cart |
|
555
|
|
|
*/ |
|
556
|
|
|
public function setGiftMessage($giftMessage) |
|
557
|
|
|
{ |
|
558
|
|
|
$this->giftMessage = $giftMessage; |
|
559
|
|
|
|
|
560
|
|
|
return $this; |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
/** |
|
564
|
|
|
* @return string |
|
565
|
|
|
*/ |
|
566
|
|
|
public function getGiftMessage() |
|
567
|
|
|
{ |
|
568
|
|
|
return $this->giftMessage; |
|
569
|
|
|
} |
|
570
|
|
|
|
|
571
|
|
|
/** |
|
572
|
|
|
* @param float $isGuest |
|
573
|
|
|
* |
|
574
|
|
|
* @return Cart |
|
575
|
|
|
*/ |
|
576
|
|
|
public function setIsGuest($isGuest) |
|
577
|
|
|
{ |
|
578
|
|
|
$this->isGuest = $isGuest; |
|
579
|
|
|
|
|
580
|
|
|
return $this; |
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
|
|
/** |
|
584
|
|
|
* @return float |
|
585
|
|
|
*/ |
|
586
|
|
|
public function getIsGuest() |
|
587
|
|
|
{ |
|
588
|
|
|
return $this->isGuest; |
|
589
|
|
|
} |
|
590
|
|
|
|
|
591
|
|
|
/** |
|
592
|
|
|
* @param int $itemsCount |
|
593
|
|
|
* |
|
594
|
|
|
* @return Cart |
|
595
|
|
|
*/ |
|
596
|
|
|
public function setItemsCount($itemsCount) |
|
597
|
|
|
{ |
|
598
|
|
|
$this->itemsCount = $itemsCount; |
|
599
|
|
|
|
|
600
|
|
|
return $this; |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
|
|
/** |
|
604
|
|
|
* @return int |
|
605
|
|
|
*/ |
|
606
|
|
|
public function getItemsCount() |
|
607
|
|
|
{ |
|
608
|
|
|
return $this->itemsCount; |
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
|
|
/** |
|
612
|
|
|
* @param string $storeCurrencyCode |
|
613
|
|
|
* |
|
614
|
|
|
* @return Cart |
|
615
|
|
|
*/ |
|
616
|
|
|
public function setStoreCurrencyCode($storeCurrencyCode) |
|
617
|
|
|
{ |
|
618
|
|
|
$this->storeCurrencyCode = $storeCurrencyCode; |
|
619
|
|
|
|
|
620
|
|
|
return $this; |
|
621
|
|
|
} |
|
622
|
|
|
|
|
623
|
|
|
/** |
|
624
|
|
|
* @return string |
|
625
|
|
|
*/ |
|
626
|
|
|
public function getStoreCurrencyCode() |
|
627
|
|
|
{ |
|
628
|
|
|
return $this->storeCurrencyCode; |
|
629
|
|
|
} |
|
630
|
|
|
|
|
631
|
|
|
/** |
|
632
|
|
|
* @param float $storeToBaseRate |
|
633
|
|
|
* |
|
634
|
|
|
* @return Cart |
|
635
|
|
|
*/ |
|
636
|
|
|
public function setStoreToBaseRate($storeToBaseRate) |
|
637
|
|
|
{ |
|
638
|
|
|
$this->storeToBaseRate = $storeToBaseRate; |
|
639
|
|
|
|
|
640
|
|
|
return $this; |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
/** |
|
644
|
|
|
* @return float |
|
645
|
|
|
*/ |
|
646
|
|
|
public function getStoreToBaseRate() |
|
647
|
|
|
{ |
|
648
|
|
|
return $this->storeToBaseRate; |
|
649
|
|
|
} |
|
650
|
|
|
|
|
651
|
|
|
/** |
|
652
|
|
|
* @param float $storeToQuoteRate |
|
653
|
|
|
* |
|
654
|
|
|
* @return Cart |
|
655
|
|
|
*/ |
|
656
|
|
|
public function setStoreToQuoteRate($storeToQuoteRate) |
|
657
|
|
|
{ |
|
658
|
|
|
$this->storeToQuoteRate = $storeToQuoteRate; |
|
659
|
|
|
|
|
660
|
|
|
return $this; |
|
661
|
|
|
} |
|
662
|
|
|
|
|
663
|
|
|
/** |
|
664
|
|
|
* @return float |
|
665
|
|
|
*/ |
|
666
|
|
|
public function getStoreToQuoteRate() |
|
667
|
|
|
{ |
|
668
|
|
|
return $this->storeToQuoteRate; |
|
669
|
|
|
} |
|
670
|
|
|
|
|
671
|
|
|
/** |
|
672
|
|
|
* @param Opportunity $opportunity |
|
673
|
|
|
* |
|
674
|
|
|
* @return Cart |
|
675
|
|
|
*/ |
|
676
|
|
|
public function setOpportunity($opportunity) |
|
677
|
|
|
{ |
|
678
|
|
|
$this->opportunity = $opportunity; |
|
679
|
|
|
|
|
680
|
|
|
return $this; |
|
681
|
|
|
} |
|
682
|
|
|
|
|
683
|
|
|
/** |
|
684
|
|
|
* @return Opportunity |
|
685
|
|
|
*/ |
|
686
|
|
|
public function getOpportunity() |
|
687
|
|
|
{ |
|
688
|
|
|
return $this->opportunity; |
|
689
|
|
|
} |
|
690
|
|
|
|
|
691
|
|
|
/** |
|
692
|
|
|
* @param string $notes |
|
693
|
|
|
* |
|
694
|
|
|
* @return Cart |
|
695
|
|
|
*/ |
|
696
|
|
|
public function setNotes($notes) |
|
697
|
|
|
{ |
|
698
|
|
|
$this->notes = $notes; |
|
699
|
|
|
return $this; |
|
700
|
|
|
} |
|
701
|
|
|
|
|
702
|
|
|
/** |
|
703
|
|
|
* @return string |
|
704
|
|
|
*/ |
|
705
|
|
|
public function getNotes() |
|
706
|
|
|
{ |
|
707
|
|
|
return $this->notes; |
|
708
|
|
|
} |
|
709
|
|
|
|
|
710
|
|
|
/** |
|
711
|
|
|
* Pre persist event listener |
|
712
|
|
|
* |
|
713
|
|
|
* @ORM\PrePersist |
|
714
|
|
|
*/ |
|
715
|
|
|
public function beforeSave() |
|
716
|
|
|
{ |
|
717
|
|
|
$this->updateNames(); |
|
718
|
|
|
} |
|
719
|
|
|
|
|
720
|
|
|
/** |
|
721
|
|
|
* Pre update event handler |
|
722
|
|
|
* |
|
723
|
|
|
* @ORM\PreUpdate |
|
724
|
|
|
*/ |
|
725
|
|
|
public function doPreUpdate() |
|
726
|
|
|
{ |
|
727
|
|
|
$this->updateNames(); |
|
728
|
|
|
} |
|
729
|
|
|
|
|
730
|
|
|
/** |
|
731
|
|
|
* @param string $statusMessage |
|
732
|
|
|
*/ |
|
733
|
|
|
public function setStatusMessage($statusMessage) |
|
734
|
|
|
{ |
|
735
|
|
|
$this->statusMessage = $statusMessage; |
|
736
|
|
|
} |
|
737
|
|
|
|
|
738
|
|
|
/** |
|
739
|
|
|
* @return string |
|
740
|
|
|
*/ |
|
741
|
|
|
public function getStatusMessage() |
|
742
|
|
|
{ |
|
743
|
|
|
return $this->statusMessage; |
|
744
|
|
|
} |
|
745
|
|
|
|
|
746
|
|
|
/** |
|
747
|
|
|
* @return User |
|
748
|
|
|
*/ |
|
749
|
|
|
public function getOwner() |
|
750
|
|
|
{ |
|
751
|
|
|
return $this->owner; |
|
752
|
|
|
} |
|
753
|
|
|
|
|
754
|
|
|
/** |
|
755
|
|
|
* @param User $user |
|
756
|
|
|
*/ |
|
757
|
|
|
public function setOwner(User $user) |
|
758
|
|
|
{ |
|
759
|
|
|
$this->owner = $user; |
|
760
|
|
|
} |
|
761
|
|
|
|
|
762
|
|
|
/** |
|
763
|
|
|
* Set organization |
|
764
|
|
|
* |
|
765
|
|
|
* @param Organization $organization |
|
766
|
|
|
* @return Cart |
|
767
|
|
|
*/ |
|
768
|
|
|
public function setOrganization(Organization $organization = null) |
|
769
|
|
|
{ |
|
770
|
|
|
$this->organization = $organization; |
|
771
|
|
|
|
|
772
|
|
|
return $this; |
|
773
|
|
|
} |
|
774
|
|
|
|
|
775
|
|
|
/** |
|
776
|
|
|
* Get organization |
|
777
|
|
|
* |
|
778
|
|
|
* @return Organization |
|
779
|
|
|
*/ |
|
780
|
|
|
public function getOrganization() |
|
781
|
|
|
{ |
|
782
|
|
|
return $this->organization; |
|
783
|
|
|
} |
|
784
|
|
|
|
|
785
|
|
|
/** |
|
786
|
|
|
* @return \DateTime |
|
787
|
|
|
*/ |
|
788
|
|
|
public function getSyncedAt() |
|
789
|
|
|
{ |
|
790
|
|
|
return $this->syncedAt; |
|
791
|
|
|
} |
|
792
|
|
|
|
|
793
|
|
|
/** |
|
794
|
|
|
* @param \DateTime|null $syncedAt |
|
795
|
|
|
* @return Cart |
|
796
|
|
|
*/ |
|
797
|
|
|
public function setSyncedAt(\DateTime $syncedAt = null) |
|
798
|
|
|
{ |
|
799
|
|
|
$this->syncedAt = $syncedAt; |
|
800
|
|
|
|
|
801
|
|
|
return $this; |
|
802
|
|
|
} |
|
803
|
|
|
|
|
804
|
|
|
/** |
|
805
|
|
|
* @return \DateTime |
|
806
|
|
|
*/ |
|
807
|
|
|
public function getImportedAt() |
|
808
|
|
|
{ |
|
809
|
|
|
return $this->importedAt; |
|
810
|
|
|
} |
|
811
|
|
|
|
|
812
|
|
|
/** |
|
813
|
|
|
* @param \DateTime|null $importedAt |
|
814
|
|
|
* @return Cart |
|
815
|
|
|
*/ |
|
816
|
|
|
public function setImportedAt(\DateTime $importedAt = null) |
|
817
|
|
|
{ |
|
818
|
|
|
$this->importedAt = $importedAt; |
|
819
|
|
|
|
|
820
|
|
|
return $this; |
|
821
|
|
|
} |
|
822
|
|
|
|
|
823
|
|
|
/** |
|
824
|
|
|
* @return string |
|
825
|
|
|
*/ |
|
826
|
|
|
public function __toString() |
|
827
|
|
|
{ |
|
828
|
|
|
return (string)$this->getId(); |
|
829
|
|
|
} |
|
830
|
|
|
} |
|
831
|
|
|
|