|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OroCRM\Bundle\MagentoBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\Collection; |
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
|
|
9
|
|
|
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config; |
|
10
|
|
|
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField; |
|
11
|
|
|
use Oro\Bundle\OrganizationBundle\Entity\Organization; |
|
12
|
|
|
use Oro\Bundle\UserBundle\Entity\User; |
|
13
|
|
|
use Oro\Bundle\AddressBundle\Entity\AddressType; |
|
14
|
|
|
use Oro\Bundle\AddressBundle\Entity\AbstractTypedAddress; |
|
15
|
|
|
use Oro\Bundle\WorkflowBundle\Entity\WorkflowItem; |
|
16
|
|
|
use Oro\Bundle\WorkflowBundle\Entity\WorkflowStep; |
|
17
|
|
|
use Oro\Bundle\LocaleBundle\Model\FirstNameInterface; |
|
18
|
|
|
use Oro\Bundle\LocaleBundle\Model\LastNameInterface; |
|
19
|
|
|
|
|
20
|
|
|
use OroCRM\Bundle\MagentoBundle\Model\ExtendOrder; |
|
21
|
|
|
use OroCRM\Bundle\ChannelBundle\Model\ChannelAwareInterface; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class Order |
|
25
|
|
|
* |
|
26
|
|
|
* @package OroCRM\Bundle\OroCRMMagentoBundle\Entity |
|
27
|
|
|
* @ORM\Entity(repositoryClass="OroCRM\Bundle\MagentoBundle\Entity\Repository\OrderRepository") |
|
28
|
|
|
* @ORM\HasLifecycleCallbacks |
|
29
|
|
|
* @ORM\Table(name="orocrm_magento_order", |
|
30
|
|
|
* indexes={ |
|
31
|
|
|
* @ORM\Index(name="mageorder_created_idx",columns={"created_at"}) |
|
32
|
|
|
* }, |
|
33
|
|
|
* uniqueConstraints={ |
|
34
|
|
|
* @ORM\UniqueConstraint(name="unq_increment_id_channel_id", columns={"increment_id", "channel_id"}) |
|
35
|
|
|
* } |
|
36
|
|
|
* ) |
|
37
|
|
|
* @Config( |
|
38
|
|
|
* routeView="orocrm_magento_order_view", |
|
39
|
|
|
* defaultValues={ |
|
40
|
|
|
* "entity"={ |
|
41
|
|
|
* "icon"="icon-list-alt" |
|
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
|
|
|
* "grid"={ |
|
56
|
|
|
* "default"="magento-order-grid", |
|
57
|
|
|
* "context"="magento-order-for-context-grid" |
|
58
|
|
|
* }, |
|
59
|
|
|
* "tag"={ |
|
60
|
|
|
* "enabled"=true |
|
61
|
|
|
* } |
|
62
|
|
|
* } |
|
63
|
|
|
* ) |
|
64
|
|
|
* @SuppressWarnings(PHPMD.ExcessivePublicCount) |
|
65
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
|
66
|
|
|
*/ |
|
67
|
|
|
class Order extends ExtendOrder implements |
|
68
|
|
|
ChannelAwareInterface, |
|
69
|
|
|
FirstNameInterface, |
|
70
|
|
|
LastNameInterface, |
|
71
|
|
|
IntegrationAwareInterface |
|
72
|
|
|
{ |
|
73
|
|
|
const STATUS_CANCELED = 'canceled'; |
|
74
|
|
|
const STATUS_COMPLETED = 'completed'; |
|
75
|
|
|
|
|
76
|
|
|
use IntegrationEntityTrait, NamesAwareTrait, ChannelEntityTrait; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string |
|
80
|
|
|
* |
|
81
|
|
|
* @ORM\Column(name="increment_id", type="string", length=60, nullable=false) |
|
82
|
|
|
* @ConfigField( |
|
83
|
|
|
* defaultValues={ |
|
84
|
|
|
* "importexport"={ |
|
85
|
|
|
* "identity"=true |
|
86
|
|
|
* } |
|
87
|
|
|
* } |
|
88
|
|
|
* ) |
|
89
|
|
|
*/ |
|
90
|
|
|
protected $incrementId; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @var Customer |
|
94
|
|
|
* |
|
95
|
|
|
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="orders") |
|
96
|
|
|
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", onDelete="SET NULL", nullable=true) |
|
97
|
|
|
*/ |
|
98
|
|
|
protected $customer; |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @var ArrayCollection |
|
102
|
|
|
* |
|
103
|
|
|
* @ORM\OneToMany(targetEntity="OrderAddress", |
|
104
|
|
|
* mappedBy="owner", cascade={"all"}, orphanRemoval=true |
|
105
|
|
|
* ) |
|
106
|
|
|
* @ConfigField( |
|
107
|
|
|
* defaultValues={ |
|
108
|
|
|
* "importexport"={ |
|
109
|
|
|
* "full"=true |
|
110
|
|
|
* } |
|
111
|
|
|
* } |
|
112
|
|
|
* ) |
|
113
|
|
|
*/ |
|
114
|
|
|
protected $addresses; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @var Store |
|
118
|
|
|
* |
|
119
|
|
|
* @ORM\ManyToOne(targetEntity="OroCRM\Bundle\MagentoBundle\Entity\Store") |
|
120
|
|
|
* @ORM\JoinColumn(name="store_id", referencedColumnName="id", onDelete="SET NULL") |
|
121
|
|
|
* @ConfigField( |
|
122
|
|
|
* defaultValues={ |
|
123
|
|
|
* "importexport"={ |
|
124
|
|
|
* "full"=false |
|
125
|
|
|
* } |
|
126
|
|
|
* } |
|
127
|
|
|
* ) |
|
128
|
|
|
*/ |
|
129
|
|
|
protected $store; |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @var boolean |
|
133
|
|
|
* |
|
134
|
|
|
* @ORM\Column(name="is_virtual", type="boolean", nullable=true) |
|
135
|
|
|
*/ |
|
136
|
|
|
protected $isVirtual = false; |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @var boolean |
|
140
|
|
|
* |
|
141
|
|
|
* @ORM\Column(name="is_guest", type="boolean", nullable=true) |
|
142
|
|
|
*/ |
|
143
|
|
|
protected $isGuest = false; |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @var string |
|
147
|
|
|
* |
|
148
|
|
|
* @ORM\Column(name="gift_message", type="string", length=255, nullable=true) |
|
149
|
|
|
*/ |
|
150
|
|
|
protected $giftMessage; |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @var string |
|
154
|
|
|
* |
|
155
|
|
|
* @ORM\Column(name="remote_ip", type="string", length=255, nullable=true) |
|
156
|
|
|
*/ |
|
157
|
|
|
protected $remoteIp; |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @var string |
|
161
|
|
|
* |
|
162
|
|
|
* @ORM\Column(name="store_name", type="string", length=255, nullable=true) |
|
163
|
|
|
*/ |
|
164
|
|
|
protected $storeName; |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @var float |
|
168
|
|
|
* |
|
169
|
|
|
* @ORM\Column(name="total_paid_amount", type="float", nullable=true) |
|
170
|
|
|
*/ |
|
171
|
|
|
protected $totalPaidAmount = 0; |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @var double |
|
175
|
|
|
* |
|
176
|
|
|
* @ORM\Column(name="total_invoiced_amount", type="money", nullable=true) |
|
177
|
|
|
*/ |
|
178
|
|
|
protected $totalInvoicedAmount = 0; |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @var double |
|
182
|
|
|
* |
|
183
|
|
|
* @ORM\Column(name="total_refunded_amount", type="money", nullable=true) |
|
184
|
|
|
*/ |
|
185
|
|
|
protected $totalRefundedAmount = 0; |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @var double |
|
189
|
|
|
* |
|
190
|
|
|
* @ORM\Column(name="total_canceled_amount", type="money", nullable=true) |
|
191
|
|
|
*/ |
|
192
|
|
|
protected $totalCanceledAmount = 0; |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @ORM\ManyToOne(targetEntity="Cart") |
|
196
|
|
|
*/ |
|
197
|
|
|
protected $cart; |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* @var OrderItem[]|Collection |
|
201
|
|
|
* |
|
202
|
|
|
* @ORM\OneToMany(targetEntity="OrderItem", mappedBy="order",cascade={"all"}) |
|
203
|
|
|
* @ConfigField( |
|
204
|
|
|
* defaultValues={ |
|
205
|
|
|
* "importexport"={ |
|
206
|
|
|
* "full"=true |
|
207
|
|
|
* } |
|
208
|
|
|
* } |
|
209
|
|
|
* ) |
|
210
|
|
|
*/ |
|
211
|
|
|
protected $items; |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* @var string |
|
215
|
|
|
* |
|
216
|
|
|
* @ORM\Column(name="notes", type="text", nullable=true) |
|
217
|
|
|
*/ |
|
218
|
|
|
protected $notes; |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @var string |
|
222
|
|
|
* |
|
223
|
|
|
* @ORM\Column(name="feedback", type="text", nullable=true) |
|
224
|
|
|
*/ |
|
225
|
|
|
protected $feedback; |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @var string |
|
229
|
|
|
* |
|
230
|
|
|
* @ORM\Column(name="customer_email", type="string", length=255, nullable=true) |
|
231
|
|
|
*/ |
|
232
|
|
|
protected $customerEmail; |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @var User |
|
236
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\UserBundle\Entity\User") |
|
237
|
|
|
* @ORM\JoinColumn(name="user_owner_id", referencedColumnName="id", onDelete="SET NULL") |
|
238
|
|
|
*/ |
|
239
|
|
|
protected $owner; |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @var Organization |
|
243
|
|
|
* |
|
244
|
|
|
* @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization") |
|
245
|
|
|
* @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") |
|
246
|
|
|
*/ |
|
247
|
|
|
protected $organization; |
|
248
|
|
|
|
|
249
|
|
|
/** |
|
250
|
|
|
* @var string |
|
251
|
|
|
* |
|
252
|
|
|
* @ORM\Column(name="coupon_code", type="string", length=255, nullable=true) |
|
253
|
|
|
*/ |
|
254
|
|
|
protected $couponCode; |
|
255
|
|
|
|
|
256
|
|
|
/** |
|
257
|
|
|
* @var \DateTime |
|
258
|
|
|
* |
|
259
|
|
|
* @ORM\Column(type="datetime", name="imported_at", nullable=true) |
|
260
|
|
|
*/ |
|
261
|
|
|
protected $importedAt; |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* @var \DateTime |
|
265
|
|
|
* |
|
266
|
|
|
* @ORM\Column(type="datetime", name="synced_at", nullable=true) |
|
267
|
|
|
*/ |
|
268
|
|
|
protected $syncedAt; |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* @param string $incrementId |
|
272
|
|
|
* |
|
273
|
|
|
* @return Order |
|
274
|
|
|
*/ |
|
275
|
|
|
public function setIncrementId($incrementId) |
|
276
|
|
|
{ |
|
277
|
|
|
$this->incrementId = $incrementId; |
|
278
|
|
|
|
|
279
|
|
|
return $this; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
/** |
|
283
|
|
|
* @return string |
|
284
|
|
|
*/ |
|
285
|
|
|
public function getIncrementId() |
|
286
|
|
|
{ |
|
287
|
|
|
return $this->incrementId; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
/** |
|
291
|
|
|
* @param string $giftMessage |
|
292
|
|
|
* |
|
293
|
|
|
* @return Order |
|
294
|
|
|
*/ |
|
295
|
|
|
public function setGiftMessage($giftMessage) |
|
296
|
|
|
{ |
|
297
|
|
|
$this->giftMessage = $giftMessage; |
|
298
|
|
|
|
|
299
|
|
|
return $this; |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* @return string |
|
304
|
|
|
*/ |
|
305
|
|
|
public function getGiftMessage() |
|
306
|
|
|
{ |
|
307
|
|
|
return $this->giftMessage; |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
/** |
|
311
|
|
|
* @param boolean $isGuest |
|
312
|
|
|
* |
|
313
|
|
|
* @return Order |
|
314
|
|
|
*/ |
|
315
|
|
|
public function setIsGuest($isGuest) |
|
316
|
|
|
{ |
|
317
|
|
|
$this->isGuest = $isGuest; |
|
318
|
|
|
|
|
319
|
|
|
return $this; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
/** |
|
323
|
|
|
* @return boolean |
|
324
|
|
|
*/ |
|
325
|
|
|
public function getIsGuest() |
|
326
|
|
|
{ |
|
327
|
|
|
return $this->isGuest; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
/** |
|
331
|
|
|
* @param boolean $isVirtual |
|
332
|
|
|
* |
|
333
|
|
|
* @return Order |
|
334
|
|
|
*/ |
|
335
|
|
|
public function setIsVirtual($isVirtual) |
|
336
|
|
|
{ |
|
337
|
|
|
$this->isVirtual = $isVirtual; |
|
338
|
|
|
|
|
339
|
|
|
return $this; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* @return boolean |
|
344
|
|
|
*/ |
|
345
|
|
|
public function getIsVirtual() |
|
346
|
|
|
{ |
|
347
|
|
|
return $this->isVirtual; |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
/** |
|
351
|
|
|
* @param Store $store |
|
352
|
|
|
* |
|
353
|
|
|
* @return Order |
|
354
|
|
|
*/ |
|
355
|
|
|
public function setStore(Store $store) |
|
356
|
|
|
{ |
|
357
|
|
|
$this->store = $store; |
|
358
|
|
|
|
|
359
|
|
|
return $this; |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
/** |
|
363
|
|
|
* @return Store |
|
364
|
|
|
*/ |
|
365
|
|
|
public function getStore() |
|
366
|
|
|
{ |
|
367
|
|
|
return $this->store; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
|
|
/** |
|
371
|
|
|
* @param string $storeName |
|
372
|
|
|
* |
|
373
|
|
|
* @return Order |
|
374
|
|
|
*/ |
|
375
|
|
|
public function setStoreName($storeName) |
|
376
|
|
|
{ |
|
377
|
|
|
$this->storeName = $storeName; |
|
378
|
|
|
|
|
379
|
|
|
return $this; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
/** |
|
383
|
|
|
* @return string |
|
384
|
|
|
*/ |
|
385
|
|
|
public function getStoreName() |
|
386
|
|
|
{ |
|
387
|
|
|
return $this->storeName; |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* @param float $totalCanceledAmount |
|
392
|
|
|
* |
|
393
|
|
|
* @return Order |
|
394
|
|
|
*/ |
|
395
|
|
|
public function setTotalCanceledAmount($totalCanceledAmount) |
|
396
|
|
|
{ |
|
397
|
|
|
$this->totalCanceledAmount = $totalCanceledAmount; |
|
398
|
|
|
|
|
399
|
|
|
return $this; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
/** |
|
403
|
|
|
* @return float |
|
404
|
|
|
*/ |
|
405
|
|
|
public function getTotalCanceledAmount() |
|
406
|
|
|
{ |
|
407
|
|
|
return $this->totalCanceledAmount; |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
/** |
|
411
|
|
|
* @param float $totalInvoicedAmount |
|
412
|
|
|
* |
|
413
|
|
|
* @return Order |
|
414
|
|
|
*/ |
|
415
|
|
|
public function setTotalInvoicedAmount($totalInvoicedAmount) |
|
416
|
|
|
{ |
|
417
|
|
|
$this->totalInvoicedAmount = $totalInvoicedAmount; |
|
418
|
|
|
|
|
419
|
|
|
return $this; |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* @return float |
|
424
|
|
|
*/ |
|
425
|
|
|
public function getTotalInvoicedAmount() |
|
426
|
|
|
{ |
|
427
|
|
|
return $this->totalInvoicedAmount; |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
/** |
|
431
|
|
|
* @param float $totalPaidAmount |
|
432
|
|
|
* |
|
433
|
|
|
* @return Order |
|
434
|
|
|
*/ |
|
435
|
|
|
public function setTotalPaidAmount($totalPaidAmount) |
|
436
|
|
|
{ |
|
437
|
|
|
$this->totalPaidAmount = $totalPaidAmount; |
|
438
|
|
|
|
|
439
|
|
|
return $this; |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
/** |
|
443
|
|
|
* @return float |
|
444
|
|
|
*/ |
|
445
|
|
|
public function getTotalPaidAmount() |
|
446
|
|
|
{ |
|
447
|
|
|
return $this->totalPaidAmount; |
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
/** |
|
451
|
|
|
* @param float $totalRefundedAmount |
|
452
|
|
|
* |
|
453
|
|
|
* @return Order |
|
454
|
|
|
*/ |
|
455
|
|
|
public function setTotalRefundedAmount($totalRefundedAmount) |
|
456
|
|
|
{ |
|
457
|
|
|
$this->totalRefundedAmount = $totalRefundedAmount; |
|
458
|
|
|
|
|
459
|
|
|
return $this; |
|
460
|
|
|
} |
|
461
|
|
|
|
|
462
|
|
|
/** |
|
463
|
|
|
* @return float |
|
464
|
|
|
*/ |
|
465
|
|
|
public function getTotalRefundedAmount() |
|
466
|
|
|
{ |
|
467
|
|
|
return $this->totalRefundedAmount; |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
/** |
|
471
|
|
|
* @param string $remoteIp |
|
472
|
|
|
* |
|
473
|
|
|
* @return Order |
|
474
|
|
|
*/ |
|
475
|
|
|
public function setRemoteIp($remoteIp) |
|
476
|
|
|
{ |
|
477
|
|
|
$this->remoteIp = $remoteIp; |
|
478
|
|
|
|
|
479
|
|
|
return $this; |
|
480
|
|
|
} |
|
481
|
|
|
|
|
482
|
|
|
/** |
|
483
|
|
|
* @return string |
|
484
|
|
|
*/ |
|
485
|
|
|
public function getRemoteIp() |
|
486
|
|
|
{ |
|
487
|
|
|
return $this->remoteIp; |
|
488
|
|
|
} |
|
489
|
|
|
|
|
490
|
|
|
/** |
|
491
|
|
|
* @param Cart $cart |
|
492
|
|
|
* |
|
493
|
|
|
* @return Order |
|
494
|
|
|
*/ |
|
495
|
|
|
public function setCart($cart = null) |
|
496
|
|
|
{ |
|
497
|
|
|
$this->cart = $cart; |
|
498
|
|
|
|
|
499
|
|
|
return $this; |
|
500
|
|
|
} |
|
501
|
|
|
|
|
502
|
|
|
/** |
|
503
|
|
|
* @return Cart |
|
504
|
|
|
*/ |
|
505
|
|
|
public function getCart() |
|
506
|
|
|
{ |
|
507
|
|
|
return $this->cart; |
|
508
|
|
|
} |
|
509
|
|
|
|
|
510
|
|
|
/** |
|
511
|
|
|
* @param string $notes |
|
512
|
|
|
* |
|
513
|
|
|
* @return Order |
|
514
|
|
|
*/ |
|
515
|
|
|
public function setNotes($notes) |
|
516
|
|
|
{ |
|
517
|
|
|
$this->notes = $notes; |
|
518
|
|
|
|
|
519
|
|
|
return $this; |
|
520
|
|
|
} |
|
521
|
|
|
|
|
522
|
|
|
/** |
|
523
|
|
|
* @return string |
|
524
|
|
|
*/ |
|
525
|
|
|
public function getNotes() |
|
526
|
|
|
{ |
|
527
|
|
|
return $this->notes; |
|
528
|
|
|
} |
|
529
|
|
|
|
|
530
|
|
|
/** |
|
531
|
|
|
* @param string $feedback |
|
532
|
|
|
* |
|
533
|
|
|
* @return Order |
|
534
|
|
|
*/ |
|
535
|
|
|
public function setFeedback($feedback) |
|
536
|
|
|
{ |
|
537
|
|
|
$this->feedback = $feedback; |
|
538
|
|
|
|
|
539
|
|
|
return $this; |
|
540
|
|
|
} |
|
541
|
|
|
|
|
542
|
|
|
/** |
|
543
|
|
|
* @return string |
|
544
|
|
|
*/ |
|
545
|
|
|
public function getFeedback() |
|
546
|
|
|
{ |
|
547
|
|
|
return $this->feedback; |
|
548
|
|
|
} |
|
549
|
|
|
|
|
550
|
|
|
/** |
|
551
|
|
|
* Pre persist event listener |
|
552
|
|
|
* |
|
553
|
|
|
* @ORM\PrePersist |
|
554
|
|
|
*/ |
|
555
|
|
|
public function beforeSave() |
|
556
|
|
|
{ |
|
557
|
|
|
$this->updateNames(); |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
/** |
|
561
|
|
|
* Pre update event handler |
|
562
|
|
|
* |
|
563
|
|
|
* @ORM\PreUpdate |
|
564
|
|
|
*/ |
|
565
|
|
|
public function doPreUpdate() |
|
566
|
|
|
{ |
|
567
|
|
|
$this->updateNames(); |
|
568
|
|
|
} |
|
569
|
|
|
|
|
570
|
|
|
/** |
|
571
|
|
|
* {@inheritdoc} |
|
572
|
|
|
*/ |
|
573
|
|
|
public function getBillingAddress() |
|
574
|
|
|
{ |
|
575
|
|
|
$addresses = $this->getAddresses()->filter( |
|
576
|
|
|
function (AbstractTypedAddress $address) { |
|
577
|
|
|
return $address->hasTypeWithName(AddressType::TYPE_BILLING); |
|
578
|
|
|
} |
|
579
|
|
|
); |
|
580
|
|
|
|
|
581
|
|
|
return $addresses->first(); |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
/** |
|
585
|
|
|
* @param string $customerEmail |
|
586
|
|
|
* |
|
587
|
|
|
* @return Order |
|
588
|
|
|
*/ |
|
589
|
|
|
public function setCustomerEmail($customerEmail) |
|
590
|
|
|
{ |
|
591
|
|
|
$this->customerEmail = $customerEmail; |
|
592
|
|
|
|
|
593
|
|
|
return $this; |
|
594
|
|
|
} |
|
595
|
|
|
|
|
596
|
|
|
/** |
|
597
|
|
|
* @return string |
|
598
|
|
|
*/ |
|
599
|
|
|
public function getCustomerEmail() |
|
600
|
|
|
{ |
|
601
|
|
|
return $this->customerEmail; |
|
602
|
|
|
} |
|
603
|
|
|
|
|
604
|
|
|
/** |
|
605
|
|
|
* @return User |
|
606
|
|
|
*/ |
|
607
|
|
|
public function getOwner() |
|
608
|
|
|
{ |
|
609
|
|
|
return $this->owner; |
|
610
|
|
|
} |
|
611
|
|
|
|
|
612
|
|
|
/** |
|
613
|
|
|
* @param User $user |
|
614
|
|
|
*/ |
|
615
|
|
|
public function setOwner(User $user) |
|
616
|
|
|
{ |
|
617
|
|
|
$this->owner = $user; |
|
618
|
|
|
} |
|
619
|
|
|
|
|
620
|
|
|
/** |
|
621
|
|
|
* Set organization |
|
622
|
|
|
* |
|
623
|
|
|
* @param Organization $organization |
|
624
|
|
|
* @return Order |
|
625
|
|
|
*/ |
|
626
|
|
|
public function setOrganization(Organization $organization = null) |
|
627
|
|
|
{ |
|
628
|
|
|
$this->organization = $organization; |
|
629
|
|
|
|
|
630
|
|
|
return $this; |
|
631
|
|
|
} |
|
632
|
|
|
|
|
633
|
|
|
/** |
|
634
|
|
|
* Get organization |
|
635
|
|
|
* |
|
636
|
|
|
* @return Organization |
|
637
|
|
|
*/ |
|
638
|
|
|
public function getOrganization() |
|
639
|
|
|
{ |
|
640
|
|
|
return $this->organization; |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
/** |
|
644
|
|
|
* @return string |
|
645
|
|
|
*/ |
|
646
|
|
|
public function getCouponCode() |
|
647
|
|
|
{ |
|
648
|
|
|
return $this->couponCode; |
|
649
|
|
|
} |
|
650
|
|
|
|
|
651
|
|
|
/** |
|
652
|
|
|
* @param string $couponCode |
|
653
|
|
|
* @return Order |
|
654
|
|
|
*/ |
|
655
|
|
|
public function setCouponCode($couponCode) |
|
656
|
|
|
{ |
|
657
|
|
|
$this->couponCode = $couponCode; |
|
658
|
|
|
|
|
659
|
|
|
return $this; |
|
660
|
|
|
} |
|
661
|
|
|
|
|
662
|
|
|
/** |
|
663
|
|
|
* @return bool |
|
664
|
|
|
*/ |
|
665
|
|
|
public function isCanceled() |
|
666
|
|
|
{ |
|
667
|
|
|
return strtolower($this->status) === self::STATUS_CANCELED; |
|
668
|
|
|
} |
|
669
|
|
|
|
|
670
|
|
|
/** |
|
671
|
|
|
* @return bool |
|
672
|
|
|
*/ |
|
673
|
|
|
public function isCompleted() |
|
674
|
|
|
{ |
|
675
|
|
|
return strtolower($this->status) === self::STATUS_COMPLETED; |
|
676
|
|
|
} |
|
677
|
|
|
|
|
678
|
|
|
/** |
|
679
|
|
|
* @return \DateTime |
|
680
|
|
|
*/ |
|
681
|
|
|
public function getSyncedAt() |
|
682
|
|
|
{ |
|
683
|
|
|
return $this->syncedAt; |
|
684
|
|
|
} |
|
685
|
|
|
|
|
686
|
|
|
/** |
|
687
|
|
|
* @param \DateTime|null $syncedAt |
|
688
|
|
|
* @return Order |
|
689
|
|
|
*/ |
|
690
|
|
|
public function setSyncedAt(\DateTime $syncedAt = null) |
|
691
|
|
|
{ |
|
692
|
|
|
$this->syncedAt = $syncedAt; |
|
693
|
|
|
|
|
694
|
|
|
return $this; |
|
695
|
|
|
} |
|
696
|
|
|
|
|
697
|
|
|
/** |
|
698
|
|
|
* @return \DateTime |
|
699
|
|
|
*/ |
|
700
|
|
|
public function getImportedAt() |
|
701
|
|
|
{ |
|
702
|
|
|
return $this->importedAt; |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
/** |
|
706
|
|
|
* @param \DateTime|null $importedAt |
|
707
|
|
|
* @return Order |
|
708
|
|
|
*/ |
|
709
|
|
|
public function setImportedAt(\DateTime $importedAt = null) |
|
710
|
|
|
{ |
|
711
|
|
|
$this->importedAt = $importedAt; |
|
712
|
|
|
|
|
713
|
|
|
return $this; |
|
714
|
|
|
} |
|
715
|
|
|
|
|
716
|
|
|
/** |
|
717
|
|
|
* @return string |
|
718
|
|
|
*/ |
|
719
|
|
|
public function __toString() |
|
720
|
|
|
{ |
|
721
|
|
|
return (string)$this->getIncrementId(); |
|
722
|
|
|
} |
|
723
|
|
|
} |
|
724
|
|
|
|