1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* WellCommerce Open-Source E-Commerce Platform |
4
|
|
|
* |
5
|
|
|
* This file is part of the WellCommerce package. |
6
|
|
|
* |
7
|
|
|
* (c) Adam Piotrowski <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, |
10
|
|
|
* please view the LICENSE file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace WellCommerce\Bundle\OrderBundle\Entity; |
14
|
|
|
|
15
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
16
|
|
|
use Doctrine\Common\Collections\Collection; |
17
|
|
|
use Knp\DoctrineBehaviors\Model\Blameable\Blameable; |
18
|
|
|
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable; |
19
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translatable; |
20
|
|
|
use WellCommerce\Bundle\AppBundle\Entity\Currency; |
21
|
|
|
use WellCommerce\Bundle\AppBundle\Entity\ShopCollectionAwareTrait; |
22
|
|
|
use WellCommerce\Bundle\AppBundle\Entity\Tax; |
23
|
|
|
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Enableable; |
24
|
|
|
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Identifiable; |
25
|
|
|
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Sortable; |
26
|
|
|
use WellCommerce\Bundle\CoreBundle\Entity\EntityInterface; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class ShippingMethod |
30
|
|
|
* |
31
|
|
|
* @author Adam Piotrowski <[email protected]> |
32
|
|
|
*/ |
33
|
|
|
class ShippingMethod implements EntityInterface |
34
|
|
|
{ |
35
|
|
|
use Identifiable; |
36
|
|
|
use Enableable; |
37
|
|
|
use Sortable; |
38
|
|
|
use Translatable; |
39
|
|
|
use Timestampable; |
40
|
|
|
use Blameable; |
41
|
|
|
use ShopCollectionAwareTrait; |
42
|
|
|
|
43
|
|
|
protected $calculator = ''; |
44
|
|
|
protected $optionsProvider = ''; |
45
|
|
|
protected $countries = []; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var Currency |
49
|
|
|
*/ |
50
|
|
|
protected $currency; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var Tax |
54
|
|
|
*/ |
55
|
|
|
protected $tax; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var Collection |
59
|
|
|
*/ |
60
|
|
|
protected $costs; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var Collection |
64
|
|
|
*/ |
65
|
|
|
protected $paymentMethods; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var Collection |
69
|
|
|
*/ |
70
|
|
|
protected $clientGroups; |
71
|
|
|
|
72
|
|
|
public function __construct() |
73
|
|
|
{ |
74
|
|
|
$this->costs = new ArrayCollection(); |
75
|
|
|
$this->paymentMethods = new ArrayCollection(); |
76
|
|
|
$this->shops = new ArrayCollection(); |
77
|
|
|
$this->clientGroups = new ArrayCollection(); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getCalculator(): string |
81
|
|
|
{ |
82
|
|
|
return $this->calculator; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function setCalculator(string $calculator) |
86
|
|
|
{ |
87
|
|
|
$this->calculator = $calculator; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getOptionsProvider(): string |
91
|
|
|
{ |
92
|
|
|
return $this->optionsProvider; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setOptionsProvider(string $optionsProvider) |
96
|
|
|
{ |
97
|
|
|
$this->optionsProvider = $optionsProvider; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getCosts(): Collection |
101
|
|
|
{ |
102
|
|
|
return $this->costs; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function setCosts(Collection $costs) |
106
|
|
|
{ |
107
|
|
|
$this->costs = $costs; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function getPaymentMethods(): Collection |
111
|
|
|
{ |
112
|
|
|
return $this->paymentMethods; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function getCountries(): array |
116
|
|
|
{ |
117
|
|
|
return $this->countries; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function setCountries(array $countries) |
121
|
|
|
{ |
122
|
|
|
$this->countries = $countries; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function getCurrency() |
126
|
|
|
{ |
127
|
|
|
return $this->currency; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function setCurrency(Currency $currency = null) |
131
|
|
|
{ |
132
|
|
|
$this->currency = $currency; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function getTax() |
136
|
|
|
{ |
137
|
|
|
return $this->tax; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function setTax(Tax $tax = null) |
141
|
|
|
{ |
142
|
|
|
$this->tax = $tax; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function getClientGroups(): Collection |
146
|
|
|
{ |
147
|
|
|
return $this->clientGroups; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function setClientGroups(Collection $clientGroups) |
151
|
|
|
{ |
152
|
|
|
$this->clientGroups = $clientGroups; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public function translate($locale = null, $fallbackToDefault = true): ShippingMethodTranslation |
156
|
|
|
{ |
157
|
|
|
return $this->doTranslate($locale, $fallbackToDefault); |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|