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

Segment   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Importance

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

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getExternalId() 0 3 1
A setCategories() 0 4 1
A setId() 0 4 1
A getCategories() 0 3 1
A getId() 0 3 1
A setSegmentOptions() 0 4 1
A setExternalId() 0 4 1
A getProducts() 0 3 1
A setProducts() 0 4 1
A getSegmentOptions() 0 3 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\SegmentInterface;
8
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentTrait;
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="loevgaard_dandomain_segments")
13
 */
14
class Segment implements SegmentInterface
15
{
16
    use SegmentTrait;
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 Category[]|ArrayCollection
36
     *
37
     * @ORM\ManyToMany(mappedBy="segments", targetEntity="Category")
38
     */
39
    protected $categories;
40
41
    /**
42
     * @var Product[]|ArrayCollection
43
     *
44
     * @ORM\ManyToMany(mappedBy="segments", targetEntity="Product")
45
     */
46
    protected $products;
47
48
    /**
49
     * @var array|null
50
     *
51
     * @ORM\Column(nullable=true, type="json")
52
     */
53
    protected $segmentOptions;
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 Segment
66
     */
67
    public function setId(int $id)
68
    {
69
        $this->id = $id;
70
        return $this;
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getExternalId(): string
77
    {
78
        return $this->externalId;
79
    }
80
81
    /**
82
     * @param string $externalId
83
     * @return Segment
84
     */
85
    public function setExternalId(string $externalId)
86
    {
87
        $this->externalId = $externalId;
88
        return $this;
89
    }
90
91
    /**
92
     * @return ArrayCollection|Category[]
93
     */
94
    public function getCategories()
95
    {
96
        return $this->categories;
97
    }
98
99
    /**
100
     * @param ArrayCollection|Category[] $categories
101
     * @return Segment
102
     */
103
    public function setCategories($categories)
104
    {
105
        $this->categories = $categories;
106
        return $this;
107
    }
108
109
    /**
110
     * @return ArrayCollection|Product[]
111
     */
112
    public function getProducts()
113
    {
114
        return $this->products;
115
    }
116
117
    /**
118
     * @param ArrayCollection|Product[] $products
119
     * @return Segment
120
     */
121
    public function setProducts($products)
122
    {
123
        $this->products = $products;
124
        return $this;
125
    }
126
127
    /**
128
     * @return array
129
     */
130
    public function getSegmentOptions()
131
    {
132
        return $this->segmentOptions;
133
    }
134
135
    /**
136
     * @param array $segmentOptions
137
     * @return Segment
138
     */
139
    public function setSegmentOptions(array $segmentOptions)
140
    {
141
        $this->segmentOptions = $segmentOptions;
142
        return $this;
143
    }
144
}
145