Completed
Push — master ( 2cf029...6368d5 )
by Joachim
12:58
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 __construct() 0 5 1
A setSortOrder() 0 4 1
A getProducts() 0 3 1
A setProducts() 0 4 1
A getText() 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 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;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\VariantInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Loevgaard\DandomainFoundation\Entity\Generated\VariantTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...\Generated\VariantTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

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