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