1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use AppBundle\Entity\User; |
7
|
|
|
use AppBundle\Entity\Poll; |
8
|
|
|
use AppBundle\Entity\Choice; |
9
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Vote |
13
|
|
|
* |
14
|
|
|
* @ORM\Table(name="votes") |
15
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\VoteRepository") |
16
|
|
|
*/ |
17
|
|
|
class Vote |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var int |
21
|
|
|
* |
22
|
|
|
* @ORM\Column(name="id", type="integer") |
23
|
|
|
* @ORM\Id |
24
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
25
|
|
|
*/ |
26
|
|
|
private $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \Poll |
30
|
|
|
* |
31
|
|
|
* @ORM\ManyToOne(targetEntity="Poll", inversedBy="votes") |
32
|
|
|
* @ORM\JoinColumn(name="poll_id", referencedColumnName="id") |
33
|
|
|
*/ |
34
|
|
|
private $poll; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var \User |
38
|
|
|
* |
39
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="votes") |
40
|
|
|
* @ORM\JoinColumn(name="caster_id", referencedColumnName="id") |
41
|
|
|
*/ |
42
|
|
|
private $caster; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var \DateTime |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(name="time", type="datetime") |
48
|
|
|
*/ |
49
|
|
|
private $time; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \Choice |
53
|
|
|
* |
54
|
|
|
* @ORM\ManyToOne(targetEntity="Choice", inversedBy="votes") |
55
|
|
|
* @ORM\JoinColumn(name="choice_id", referencedColumnName="id") |
56
|
|
|
*/ |
57
|
|
|
private $choice; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get id |
61
|
|
|
* |
62
|
|
|
* @return integer |
63
|
|
|
*/ |
64
|
|
|
public function getId(): int |
65
|
|
|
{ |
66
|
|
|
return $this->id; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Set time |
71
|
|
|
* |
72
|
|
|
* @param \DateTime $time |
73
|
|
|
* |
74
|
|
|
* @return Vote |
75
|
|
|
*/ |
76
|
|
|
public function setTime(\DateTimeInterface $time) |
77
|
|
|
{ |
78
|
|
|
$this->time = $time; |
|
|
|
|
79
|
|
|
|
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Get time |
85
|
|
|
* |
86
|
|
|
* @return \DateTime |
87
|
|
|
*/ |
88
|
|
|
public function getTime(): DateTime |
89
|
|
|
{ |
90
|
|
|
return $this->time; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Set poll |
95
|
|
|
* |
96
|
|
|
* @param \AppBundle\Entity\Poll $poll |
97
|
|
|
* |
98
|
|
|
* @return Vote |
99
|
|
|
*/ |
100
|
|
|
public function setPoll(Poll $poll = null) |
101
|
|
|
{ |
102
|
|
|
$this->poll = $poll; |
|
|
|
|
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Get poll |
109
|
|
|
* |
110
|
|
|
* @return \AppBundle\Entity\Poll |
111
|
|
|
*/ |
112
|
|
|
public function getPoll(): Poll |
113
|
|
|
{ |
114
|
|
|
return $this->poll; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Set caster |
119
|
|
|
* |
120
|
|
|
* @param \AppBundle\Entity\User $caster |
121
|
|
|
* |
122
|
|
|
* @return Vote |
123
|
|
|
*/ |
124
|
|
|
public function setCaster(User $caster = null) |
125
|
|
|
{ |
126
|
|
|
$this->caster = $caster; |
|
|
|
|
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Get caster |
133
|
|
|
* |
134
|
|
|
* @return \AppBundle\Entity\User |
135
|
|
|
*/ |
136
|
|
|
public function getCaster(): User |
137
|
|
|
{ |
138
|
|
|
return $this->caster; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Set choice |
143
|
|
|
* |
144
|
|
|
* @param \AppBundle\Entity\Choice $choice |
145
|
|
|
* |
146
|
|
|
* @return Vote |
147
|
|
|
*/ |
148
|
|
|
public function setChoice(Choice $choice = null) |
149
|
|
|
{ |
150
|
|
|
$this->choice = $choice; |
|
|
|
|
151
|
|
|
|
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Get choice |
157
|
|
|
* |
158
|
|
|
* @return \AppBundle\Entity\Choice |
159
|
|
|
*/ |
160
|
|
|
public function getChoice(): Choice |
161
|
|
|
{ |
162
|
|
|
return $this->choice; |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.