Completed
Push — master ( 89f754...0e5042 )
by Michael
03:54
created

PollType   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 99
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A addPoll() 0 6 1
A removePoll() 0 4 1
A getPolls() 0 4 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use AppBundle\Entity\Poll;
8
9
/**
10
 * PollType
11
 *
12
 * @ORM\Table(name="poll_type")
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\PollTypeRepository")
14
 */
15
class PollType
16
{
17
    /**
18
     * @var int
19
     *
20
     * @ORM\Column(name="id", type="integer")
21
     * @ORM\Id
22
     * @ORM\GeneratedValue(strategy="AUTO")
23
     */
24
    private $id;
25
26
    /**
27
     * @var string
28
     *
29
     * @ORM\Column(name="name", type="string", length=255, unique=true)
30
     */
31
    private $name;
32
33
    /**
34
     * @ORM\OneToMany(targetEntity="Poll", mappedBy="pollType")
35
     */
36
    private $polls;
37
38
    /**
39
     * Constructor
40
     */
41
    public function __construct()
42
    {
43
        $this->polls = new ArrayCollection();
44
    }
45
46
    /**
47
     * Get id
48
     *
49
     * @return int
50
     */
51
    public function getId(): int
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * Set name
58
     *
59
     * @param string $name
60
     *
61
     * @return PollType
62
     */
63
    public function setName(string $name)
64
    {
65
        $this->name = $name;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Get name
72
     *
73
     * @return string
74
     */
75
    public function getName(): string
76
    {
77
        return $this->name;
78
    }
79
80
    /**
81
     * Add poll
82
     *
83
     * @param \AppBundle\Entity\Poll $poll
84
     *
85
     * @return PollType
86
     */
87
    public function addPoll(Poll $poll)
88
    {
89
        $this->polls[] = $poll;
90
91
        return $this;
92
    }
93
94
    /**
95
     * Remove poll
96
     *
97
     * @param \AppBundle\Entity\Poll $poll
98
     */
99
    public function removePoll(Poll $poll)
100
    {
101
        $this->polls->removeElement($poll);
102
    }
103
104
    /**
105
     * Get polls
106
     *
107
     * @return \Doctrine\Common\Collections\Collection
108
     */
109
    public function getPolls()
110
    {
111
        return $this->polls;
112
    }
113
}
114