1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerInterface; |
8
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity() |
12
|
|
|
* @ORM\Table(name="loevgaard_dandomain_manufacturers") |
13
|
|
|
*/ |
14
|
|
|
class Manufacturer implements ManufacturerInterface |
15
|
|
|
{ |
16
|
|
|
use ManufacturerTrait; |
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
|
|
|
* @ORM\Column(type="string", unique=true) |
31
|
|
|
*/ |
32
|
|
|
protected $externalId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string|null |
36
|
|
|
* |
37
|
|
|
* @ORM\Column(nullable=true, type="string") |
38
|
|
|
*/ |
39
|
|
|
protected $link; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string|null |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(nullable=true, type="text") |
45
|
|
|
*/ |
46
|
|
|
protected $linkText; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string|null |
50
|
|
|
* |
51
|
|
|
* @ORM\Column(nullable=true, type="string") |
52
|
|
|
*/ |
53
|
|
|
protected $name; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var Product[]|ArrayCollection |
57
|
|
|
* |
58
|
|
|
* @ORM\ManyToMany(mappedBy="manufacturers", targetEntity="Product") |
59
|
|
|
*/ |
60
|
|
|
protected $products; |
61
|
|
|
|
62
|
|
|
public function __construct() |
63
|
|
|
{ |
64
|
|
|
$this->products = new ArrayCollection(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return int |
69
|
|
|
*/ |
70
|
|
|
public function getId(): int |
71
|
|
|
{ |
72
|
|
|
return (int)$this->id; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param int $id |
77
|
|
|
* @return Manufacturer |
78
|
|
|
*/ |
79
|
|
|
public function setId(int $id) |
80
|
|
|
{ |
81
|
|
|
$this->id = $id; |
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getExternalId(): string |
89
|
|
|
{ |
90
|
|
|
return (string)$this->externalId; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param string $externalId |
95
|
|
|
* @return Manufacturer |
96
|
|
|
*/ |
97
|
|
|
public function setExternalId(string $externalId) |
98
|
|
|
{ |
99
|
|
|
$this->externalId = $externalId; |
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return null|string |
105
|
|
|
*/ |
106
|
|
|
public function getLink() |
107
|
|
|
{ |
108
|
|
|
return $this->link; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param null|string $link |
113
|
|
|
* @return Manufacturer |
114
|
|
|
*/ |
115
|
|
|
public function setLink($link) |
116
|
|
|
{ |
117
|
|
|
$this->link = $link; |
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return null|string |
123
|
|
|
*/ |
124
|
|
|
public function getLinkText() |
125
|
|
|
{ |
126
|
|
|
return $this->linkText; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param null|string $linkText |
131
|
|
|
* @return Manufacturer |
132
|
|
|
*/ |
133
|
|
|
public function setLinkText($linkText) |
134
|
|
|
{ |
135
|
|
|
$this->linkText = $linkText; |
136
|
|
|
return $this; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return null|string |
141
|
|
|
*/ |
142
|
|
|
public function getName() |
143
|
|
|
{ |
144
|
|
|
return $this->name; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param null|string $name |
149
|
|
|
* @return Manufacturer |
150
|
|
|
*/ |
151
|
|
|
public function setName($name) |
152
|
|
|
{ |
153
|
|
|
$this->name = $name; |
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @return ArrayCollection|Product[] |
159
|
|
|
*/ |
160
|
|
|
public function getProducts() |
161
|
|
|
{ |
162
|
|
|
return $this->products; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param ArrayCollection|Product[] $products |
167
|
|
|
* @return Manufacturer |
168
|
|
|
*/ |
169
|
|
|
public function setProducts($products) |
170
|
|
|
{ |
171
|
|
|
$this->products = $products; |
172
|
|
|
return $this; |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|