Completed
Push — master ( 13633f...2513f1 )
by Joachim
15:06
created

Variant   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 186
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 15
dl 0
loc 186
c 0
b 0
f 0
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A setSortOrder() 0 4 1
A setProducts() 0 4 1
A getText() 0 3 1
A getProducts() 0 3 1
A setText() 0 4 1
A getExternalId() 0 3 1
A getSortOrder() 0 3 1
A setExternalId() 0 4 1
A getDisabledProducts() 0 3 1
A setDisabledProducts() 0 4 1
A setId() 0 4 1
A __construct() 0 5 1
A getId() 0 3 1
A getVariantGroups() 0 3 1
A setVariantGroups() 0 4 1
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\VariantInterface;
8
use Loevgaard\DandomainFoundation\Entity\Generated\VariantTrait;
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="loevgaard_dandomain_variants")
13
 */
14
class Variant implements VariantInterface
15
{
16
    use VariantTrait;
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
29
     *
30
     * @ORM\Column(type="integer", unique=true)
31
     */
32
    protected $externalId;
33
34
    /**
35
     * @var int|null
36
     *
37
     * @ORM\Column(nullable=true, type="integer")
38
     */
39
    protected $sortOrder;
40
41
    /**
42
     * @var string|null
43
     *
44
     * @ORM\Column(nullable=true, type="string")
45
     */
46
    protected $text;
47
48
    /**
49
     * @var Product[]|ArrayCollection
50
     *
51
     * @ORM\ManyToMany(mappedBy="disabledVariants", targetEntity="Product")
52
     */
53
    protected $disabledProducts;
54
55
    /**
56
     * @var Product[]|ArrayCollection
57
     *
58
     * @ORM\ManyToMany(mappedBy="variants", targetEntity="Product")
59
     */
60
    protected $products;
61
62
    /**
63
     * @var VariantGroup[]|ArrayCollection
64
     *
65
     * @ORM\ManyToMany(mappedBy="variants", targetEntity="VariantGroup")
66
     */
67
    protected $variantGroups;
68
69
    public function __construct()
70
    {
71
        $this->disabledProducts = new ArrayCollection();
72
        $this->products = new ArrayCollection();
73
        $this->variantGroups = new ArrayCollection();
74
    }
75
76
    /**
77
     * @return int
78
     */
79
    public function getId(): int
80
    {
81
        return (int)$this->id;
82
    }
83
84
    /**
85
     * @param int $id
86
     * @return Variant
87
     */
88
    public function setId(int $id)
89
    {
90
        $this->id = $id;
91
        return $this;
92
    }
93
94
    /**
95
     * @return int
96
     */
97
    public function getExternalId(): int
98
    {
99
        return (int)$this->externalId;
100
    }
101
102
    /**
103
     * @param int $externalId
104
     * @return Variant
105
     */
106
    public function setExternalId(int $externalId)
107
    {
108
        $this->externalId = $externalId;
109
        return $this;
110
    }
111
112
    /**
113
     * @return int|null
114
     */
115
    public function getSortOrder()
116
    {
117
        return $this->sortOrder;
118
    }
119
120
    /**
121
     * @param int|null $sortOrder
122
     * @return Variant
123
     */
124
    public function setSortOrder($sortOrder)
125
    {
126
        $this->sortOrder = $sortOrder;
127
        return $this;
128
    }
129
130
    /**
131
     * @return null|string
132
     */
133
    public function getText()
134
    {
135
        return $this->text;
136
    }
137
138
    /**
139
     * @param null|string $text
140
     * @return Variant
141
     */
142
    public function setText($text)
143
    {
144
        $this->text = $text;
145
        return $this;
146
    }
147
148
    /**
149
     * @return ArrayCollection|Product[]
150
     */
151
    public function getDisabledProducts()
152
    {
153
        return $this->disabledProducts;
154
    }
155
156
    /**
157
     * @param ArrayCollection|Product[] $disabledProducts
158
     * @return Variant
159
     */
160
    public function setDisabledProducts($disabledProducts)
161
    {
162
        $this->disabledProducts = $disabledProducts;
163
        return $this;
164
    }
165
166
    /**
167
     * @return ArrayCollection|Product[]
168
     */
169
    public function getProducts()
170
    {
171
        return $this->products;
172
    }
173
174
    /**
175
     * @param ArrayCollection|Product[] $products
176
     * @return Variant
177
     */
178
    public function setProducts($products)
179
    {
180
        $this->products = $products;
181
        return $this;
182
    }
183
184
    /**
185
     * @return ArrayCollection|VariantGroup[]
186
     */
187
    public function getVariantGroups()
188
    {
189
        return $this->variantGroups;
190
    }
191
192
    /**
193
     * @param ArrayCollection|VariantGroup[] $variantGroups
194
     * @return Variant
195
     */
196
    public function setVariantGroups($variantGroups)
197
    {
198
        $this->variantGroups = $variantGroups;
199
        return $this;
200
    }
201
}
202