1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\PakkelabelsBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
7
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This entity maps any (shipping method) string to a product code and optional service codes. |
11
|
|
|
* |
12
|
|
|
* @ORM\Entity |
13
|
|
|
* @ORM\Table(name="pakkelabels_shipping_method_mapping") |
14
|
|
|
* @UniqueEntity("source") |
15
|
|
|
*/ |
16
|
|
|
class ShippingMethodMapping |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var int |
20
|
|
|
* |
21
|
|
|
* @ORM\Id |
22
|
|
|
* @ORM\GeneratedValue |
23
|
|
|
* @ORM\Column(type="integer") |
24
|
|
|
*/ |
25
|
|
|
protected $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
* |
30
|
|
|
* @Assert\NotBlank() |
31
|
|
|
* |
32
|
|
|
* @ORM\Column(type="string", unique=true) |
33
|
|
|
*/ |
34
|
|
|
protected $source; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
* |
39
|
|
|
* @Assert\NotBlank() |
40
|
|
|
* |
41
|
|
|
* @ORM\Column(type="string") |
42
|
|
|
*/ |
43
|
|
|
protected $productCode; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var array |
47
|
|
|
* |
48
|
|
|
* @ORM\Column(type="array", nullable=true) |
49
|
|
|
*/ |
50
|
|
|
protected $serviceCodes; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
* |
55
|
|
|
* @ORM\Column(type="string", nullable=true) |
56
|
|
|
*/ |
57
|
|
|
protected $returnProductCode; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var array |
61
|
|
|
* |
62
|
|
|
* @ORM\Column(type="array", nullable=true) |
63
|
|
|
*/ |
64
|
|
|
protected $returnServiceCodes; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return int |
68
|
|
|
*/ |
69
|
|
|
public function getId(): ?int |
70
|
|
|
{ |
71
|
|
|
return $this->id; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param int $id |
76
|
|
|
* |
77
|
|
|
* @return ShippingMethodMapping |
78
|
|
|
*/ |
79
|
|
|
public function setId(int $id): self |
80
|
|
|
{ |
81
|
|
|
$this->id = $id; |
82
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function getSource(): ?string |
90
|
|
|
{ |
91
|
|
|
return $this->source; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $source |
96
|
|
|
* |
97
|
|
|
* @return ShippingMethodMapping |
98
|
|
|
*/ |
99
|
|
|
public function setSource(string $source): self |
100
|
|
|
{ |
101
|
|
|
$this->source = $source; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public function getProductCode(): ?string |
110
|
|
|
{ |
111
|
|
|
return $this->productCode; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param string $productCode |
116
|
|
|
* |
117
|
|
|
* @return ShippingMethodMapping |
118
|
|
|
*/ |
119
|
|
|
public function setProductCode(string $productCode): self |
120
|
|
|
{ |
121
|
|
|
$this->productCode = $productCode; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return array |
128
|
|
|
*/ |
129
|
|
|
public function getServiceCodes(): ?array |
130
|
|
|
{ |
131
|
|
|
return $this->serviceCodes; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param array $serviceCodes |
136
|
|
|
* |
137
|
|
|
* @return ShippingMethodMapping |
138
|
|
|
*/ |
139
|
|
|
public function setServiceCodes(array $serviceCodes): self |
140
|
|
|
{ |
141
|
|
|
$this->serviceCodes = $serviceCodes; |
142
|
|
|
|
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function getReturnProductCode(): ?string |
150
|
|
|
{ |
151
|
|
|
return $this->returnProductCode; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param string $returnProductCode |
156
|
|
|
* |
157
|
|
|
* @return ShippingMethodMapping |
158
|
|
|
*/ |
159
|
|
|
public function setReturnProductCode(string $returnProductCode): self |
160
|
|
|
{ |
161
|
|
|
$this->returnProductCode = $returnProductCode; |
162
|
|
|
|
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return array |
168
|
|
|
*/ |
169
|
|
|
public function getReturnServiceCodes(): ?array |
170
|
|
|
{ |
171
|
|
|
return $this->returnServiceCodes; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param array $returnServiceCodes |
176
|
|
|
* |
177
|
|
|
* @return ShippingMethodMapping |
178
|
|
|
*/ |
179
|
|
|
public function setReturnServiceCodes(array $returnServiceCodes): self |
180
|
|
|
{ |
181
|
|
|
$this->returnServiceCodes = $returnServiceCodes; |
182
|
|
|
|
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|