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

Choice::setChoiceName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use AppBundle\Entity\Vote;
7
use Doctrine\Common\Collections\ArrayCollection;
8
9
/**
10
 * Choice
11
 *
12
 * @ORM\Table(name="choices")
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\ChoiceRepository")
14
 */
15
class Choice
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="choice_name", type="string", length=255)
30
     */
31
    private $choiceName;
32
33
    /**
34
     * @ORM\OneToMany(targetEntity="Vote", mappedBy="choice")
35
     */
36
    private $votes;
37
38
    /**
39
     * Constructor
40
     */
41
    public function __construct()
42
    {
43
        $this->votes = new ArrayCollection();
44
    }
45
46
    /**
47
     * Get id
48
     *
49
     * @return integer
50
     */
51
    public function getId(): int
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * Set choiceName
58
     *
59
     * @param string $choiceName
60
     *
61
     * @return Choice
62
     */
63
    public function setChoiceName(string $choiceName)
64
    {
65
        $this->choiceName = $choiceName;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Get choiceName
72
     *
73
     * @return string
74
     */
75
    public function getChoiceName(): string
76
    {
77
        return $this->choiceName;
78
    }
79
80
    /**
81
     * Add vote
82
     *
83
     * @param \AppBundle\Entity\Vote $vote
84
     *
85
     * @return Choice
86
     */
87
    public function addVote(Vote $vote)
88
    {
89
        $this->votes[] = $vote;
90
91
        return $this;
92
    }
93
94
    /**
95
     * Remove vote
96
     *
97
     * @param \AppBundle\Entity\Vote $vote
98
     */
99
    public function removeVote(Vote $vote)
100
    {
101
        $this->votes->removeElement($vote);
102
    }
103
104
    /**
105
     * Get votes
106
     *
107
     * @return \Doctrine\Common\Collections\Collection
108
     */
109
    public function getVotes()
110
    {
111
        return $this->votes;
112
    }
113
}
114