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\ProductRelationInterface; |
8
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductRelationTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity() |
12
|
|
|
* @ORM\Table(name="loevgaard_dandomain_product_relations") |
13
|
|
|
*/ |
14
|
|
|
class ProductRelation implements ProductRelationInterface |
15
|
|
|
{ |
16
|
|
|
use ProductRelationTrait; |
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 int|null |
29
|
|
|
* |
30
|
|
|
* @ORM\Column(nullable=true, type="string") |
31
|
|
|
*/ |
32
|
|
|
protected $productNumber; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int|null |
36
|
|
|
* |
37
|
|
|
* @ORM\Column(nullable=true, type="integer") |
38
|
|
|
*/ |
39
|
|
|
protected $relatedType; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var int|null |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(nullable=true, type="integer") |
45
|
|
|
*/ |
46
|
|
|
protected $sortOrder; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var Product[]|ArrayCollection |
50
|
|
|
* |
51
|
|
|
* @ORM\ManyToMany(mappedBy="productRelations", targetEntity="Product") |
52
|
|
|
*/ |
53
|
|
|
protected $products; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return int |
57
|
|
|
*/ |
58
|
|
|
public function getId(): int |
59
|
|
|
{ |
60
|
|
|
return (int)$this->id; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param int $id |
65
|
|
|
* @return ProductRelation |
66
|
|
|
*/ |
67
|
|
|
public function setId(int $id) |
68
|
|
|
{ |
69
|
|
|
$this->id = $id; |
70
|
|
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return int|null |
75
|
|
|
*/ |
76
|
|
|
public function getProductNumber() |
77
|
|
|
{ |
78
|
|
|
return $this->productNumber; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int|null $productNumber |
83
|
|
|
* @return ProductRelation |
84
|
|
|
*/ |
85
|
|
|
public function setProductNumber($productNumber) |
86
|
|
|
{ |
87
|
|
|
$this->productNumber = $productNumber; |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return int|null |
93
|
|
|
*/ |
94
|
|
|
public function getRelatedType() |
95
|
|
|
{ |
96
|
|
|
return $this->relatedType; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param int|null $relatedType |
101
|
|
|
* @return ProductRelation |
102
|
|
|
*/ |
103
|
|
|
public function setRelatedType($relatedType) |
104
|
|
|
{ |
105
|
|
|
$this->relatedType = $relatedType; |
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return int|null |
111
|
|
|
*/ |
112
|
|
|
public function getSortOrder() |
113
|
|
|
{ |
114
|
|
|
return $this->sortOrder; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param int|null $sortOrder |
119
|
|
|
* @return ProductRelation |
120
|
|
|
*/ |
121
|
|
|
public function setSortOrder($sortOrder) |
122
|
|
|
{ |
123
|
|
|
$this->sortOrder = $sortOrder; |
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return ArrayCollection|Product[] |
129
|
|
|
*/ |
130
|
|
|
public function getProducts() |
131
|
|
|
{ |
132
|
|
|
return $this->products; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @param ArrayCollection|Product[] $products |
137
|
|
|
* @return ProductRelation |
138
|
|
|
*/ |
139
|
|
|
public function setProducts($products) |
140
|
|
|
{ |
141
|
|
|
$this->products = $products; |
142
|
|
|
return $this; |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|