1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* Copyright 2014-2016 Arnaud Bienvenu |
4
|
|
|
* |
5
|
|
|
* This file is part of Kyela. |
6
|
|
|
|
7
|
|
|
* Kyela is free software: you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU Affero General Public License as published by |
9
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
10
|
|
|
* (at your option) any later version. |
11
|
|
|
|
12
|
|
|
* Kyela is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
18
|
|
|
* along with Kyela. If not, see <http://www.gnu.org/licenses/>. |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Abienvenu\KyelaBundle\Entity; |
23
|
|
|
|
24
|
|
|
use Doctrine\ORM\Mapping as ORM; |
25
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Participation |
29
|
|
|
* |
30
|
|
|
* @ORM\Table(uniqueConstraints={ |
31
|
|
|
* @ORM\UniqueConstraint(name="participant_event_unicity", columns={"participant_id", "event_id"}) |
32
|
|
|
* }) |
33
|
|
|
* @ORM\Entity |
34
|
|
|
* @UniqueEntity(fields={"participant", "event"}) |
35
|
|
|
*/ |
36
|
|
|
class Participation |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @var integer |
40
|
|
|
* |
41
|
|
|
* @ORM\Column(name="id", type="integer") |
42
|
|
|
* @ORM\Id |
43
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
44
|
|
|
*/ |
45
|
|
|
private $id; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @ORM\ManyToOne(targetEntity="Participant", inversedBy="participations") |
49
|
|
|
*/ |
50
|
|
|
private $participant; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @ORM\ManyToOne(targetEntity="Event", inversedBy="participations") |
54
|
|
|
*/ |
55
|
|
|
private $event; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @ORM\ManyToOne(targetEntity="Choice", inversedBy="participations") |
59
|
|
|
*/ |
60
|
|
|
private $choice; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get id |
64
|
|
|
* |
65
|
|
|
* @return integer |
66
|
|
|
*/ |
67
|
|
|
public function getId() |
68
|
|
|
{ |
69
|
|
|
return $this->id; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Set participant |
74
|
|
|
* |
75
|
|
|
* @param Participant $participant |
76
|
|
|
* @return Participation |
77
|
|
|
*/ |
78
|
|
|
public function setParticipant(Participant $participant = null) |
79
|
|
|
{ |
80
|
|
|
$this->participant = $participant; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Get participant |
87
|
|
|
* |
88
|
|
|
* @return Participant |
89
|
|
|
*/ |
90
|
|
|
public function getParticipant() |
91
|
|
|
{ |
92
|
|
|
return $this->participant; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Set event |
97
|
|
|
* |
98
|
|
|
* @param Event $event |
99
|
|
|
* @return Participation |
100
|
|
|
*/ |
101
|
|
|
public function setEvent(Event $event = null) |
102
|
|
|
{ |
103
|
|
|
$this->event = $event; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get event |
110
|
|
|
* |
111
|
|
|
* @return Event |
112
|
|
|
*/ |
113
|
|
|
public function getEvent() |
114
|
|
|
{ |
115
|
|
|
return $this->event; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Set choice |
120
|
|
|
* |
121
|
|
|
* @param Choice $choice |
122
|
|
|
* @return Participation |
123
|
|
|
*/ |
124
|
|
|
public function setChoice(Choice $choice = null) |
125
|
|
|
{ |
126
|
|
|
$this->choice = $choice; |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Get choice |
133
|
|
|
* |
134
|
|
|
* @return Choice |
135
|
|
|
*/ |
136
|
|
|
public function getChoice() |
137
|
|
|
{ |
138
|
|
|
return $this->choice; |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|