1 | <?php |
||
13 | class User extends BaseUser |
||
14 | { |
||
15 | /** |
||
16 | * @ORM\Id |
||
17 | * @ORM\Column(type="integer") |
||
18 | * @ORM\GeneratedValue(strategy="AUTO") |
||
19 | */ |
||
20 | protected $id; |
||
21 | |||
22 | /** |
||
23 | * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Group") |
||
24 | * @ORM\JoinTable(name="fos_user_user_group", |
||
25 | * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, |
||
26 | * inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")} |
||
27 | * ) |
||
28 | */ |
||
29 | protected $groups; |
||
30 | |||
31 | /** |
||
32 | * @ORM\OneToMany(targetEntity="Poll", mappedBy="creator") |
||
33 | */ |
||
34 | private $createdPolls; |
||
35 | |||
36 | /** |
||
37 | * @ORM\Column(type="string") |
||
38 | */ |
||
39 | protected $name; |
||
40 | |||
41 | /** |
||
42 | * @ORM\OneToMany(targetEntity="Vote", mappedBy="caster") |
||
43 | */ |
||
44 | private $votes; |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | */ |
||
49 | 1 | public function __construct() |
|
50 | { |
||
51 | 1 | parent::__construct(); |
|
52 | |||
53 | 1 | $this->createdPolls = new ArrayCollection(); |
|
54 | 1 | $this->votes = new ArrayCollection(); |
|
55 | 1 | } |
|
56 | |||
57 | /** |
||
58 | * Set name. |
||
59 | * |
||
60 | * @param string $name |
||
61 | * |
||
62 | * @return Poll |
||
63 | */ |
||
64 | public function setName(string $name) |
||
70 | |||
71 | /** |
||
72 | * Get name. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getName(): string |
||
80 | |||
81 | /** |
||
82 | * Add createdPoll. |
||
83 | * |
||
84 | * @param \AppBundle\Entity\Poll $createdPoll |
||
85 | * |
||
86 | * @return User |
||
87 | */ |
||
88 | public function addCreatedPoll(\AppBundle\Entity\Poll $createdPoll) |
||
94 | |||
95 | /** |
||
96 | * Remove createdPoll. |
||
97 | * |
||
98 | * @param \AppBundle\Entity\Poll $createdPoll |
||
99 | */ |
||
100 | public function removeCreatedPoll(\AppBundle\Entity\Poll $createdPoll) |
||
101 | { |
||
102 | $this->createdPolls->removeElement($createdPoll); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Get createdPolls. |
||
107 | * |
||
108 | * @return \Doctrine\Common\Collections\Collection |
||
109 | */ |
||
110 | public function getCreatedPolls() |
||
114 | |||
115 | /** |
||
116 | * Add vote. |
||
117 | * |
||
118 | * @param \AppBundle\Entity\Vote $vote |
||
119 | * |
||
120 | * @return User |
||
121 | */ |
||
122 | public function addVote(\AppBundle\Entity\Vote $vote) |
||
128 | |||
129 | /** |
||
130 | * Remove vote. |
||
131 | * |
||
132 | * @param \AppBundle\Entity\Vote $vote |
||
133 | */ |
||
134 | public function removeVote(\AppBundle\Entity\Vote $vote) |
||
135 | { |
||
136 | $this->votes->removeElement($vote); |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * Get votes. |
||
141 | * |
||
142 | * @return \Doctrine\Common\Collections\Collection |
||
143 | */ |
||
144 | public function getVotes() |
||
148 | } |
||
149 |