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