|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
ÁTICA - Aplicación web para la gestión documental de centros educativos |
|
4
|
|
|
|
|
5
|
|
|
Copyright (C) 2015-2016: Luis Ramón López López |
|
6
|
|
|
|
|
7
|
|
|
This program 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
|
|
|
This program 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 this program. If not, see [http://www.gnu.org/licenses/]. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppBundle\Entity; |
|
22
|
|
|
|
|
23
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
24
|
|
|
use Doctrine\Common\Collections\Collection; |
|
25
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @ORM\Entity |
|
29
|
|
|
*/ |
|
30
|
|
View Code Duplication |
class Activity |
|
|
|
|
|
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* @ORM\Id |
|
34
|
|
|
* @ORM\Column(type="integer") |
|
35
|
|
|
* @ORM\GeneratedValue |
|
36
|
|
|
* @var int |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $id; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @ORM\Column(type="string", nullable=true) |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $code; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @ORM\Column(type="string") |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $name; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @ORM\Column(type="text", nullable=true) |
|
54
|
|
|
* @var string |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $description; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @ORM\ManyToOne(targetEntity="LearningOutcome", inversedBy="activities") |
|
60
|
|
|
* @ORM\JoinColumn(nullable=false) |
|
61
|
|
|
* @var LearningOutcome |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $learningOutcome; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @ORM\OneToMany(targetEntity="Criterion", mappedBy="activity") |
|
67
|
|
|
* @var Collection |
|
68
|
|
|
*/ |
|
69
|
|
|
protected $criteria; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @ORM\Column(type="integer", nullable=true) |
|
73
|
|
|
* @var int |
|
74
|
|
|
*/ |
|
75
|
|
|
protected $orderNr; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Constructor |
|
79
|
|
|
*/ |
|
80
|
|
|
public function __construct() |
|
81
|
|
|
{ |
|
82
|
|
|
$this->criteria = new ArrayCollection(); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Get id |
|
87
|
|
|
* |
|
88
|
|
|
* @return integer |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getId() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->id; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @return string |
|
97
|
|
|
*/ |
|
98
|
|
|
public function __toString() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->getCode() ? $this->getCode() . ': ' . $this->getName() : $this->getName(); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Set name |
|
105
|
|
|
* |
|
106
|
|
|
* @param string $name |
|
107
|
|
|
* |
|
108
|
|
|
* @return Activity |
|
109
|
|
|
*/ |
|
110
|
|
|
public function setName($name) |
|
111
|
|
|
{ |
|
112
|
|
|
$this->name = $name; |
|
113
|
|
|
|
|
114
|
|
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Get name |
|
119
|
|
|
* |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getName() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->name; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Set description |
|
129
|
|
|
* |
|
130
|
|
|
* @param string $description |
|
131
|
|
|
* |
|
132
|
|
|
* @return Activity |
|
133
|
|
|
*/ |
|
134
|
|
|
public function setDescription($description) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->description = $description; |
|
137
|
|
|
|
|
138
|
|
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* Get description |
|
143
|
|
|
* |
|
144
|
|
|
* @return string |
|
145
|
|
|
*/ |
|
146
|
|
|
public function getDescription() |
|
147
|
|
|
{ |
|
148
|
|
|
return $this->description; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Set order |
|
153
|
|
|
* |
|
154
|
|
|
* @param integer $orderNr |
|
155
|
|
|
* |
|
156
|
|
|
* @return Activity |
|
157
|
|
|
*/ |
|
158
|
|
|
public function setOrderNr($orderNr) |
|
159
|
|
|
{ |
|
160
|
|
|
$this->orderNr = $orderNr; |
|
161
|
|
|
|
|
162
|
|
|
return $this; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Get order |
|
167
|
|
|
* |
|
168
|
|
|
* @return integer |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getOrderNr() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->orderNr; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Set code |
|
177
|
|
|
* |
|
178
|
|
|
* @param string $code |
|
179
|
|
|
* |
|
180
|
|
|
* @return Activity |
|
181
|
|
|
*/ |
|
182
|
|
|
public function setCode($code) |
|
183
|
|
|
{ |
|
184
|
|
|
$this->code = $code; |
|
185
|
|
|
|
|
186
|
|
|
return $this; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* Get code |
|
191
|
|
|
* |
|
192
|
|
|
* @return string |
|
193
|
|
|
*/ |
|
194
|
|
|
public function getCode() |
|
195
|
|
|
{ |
|
196
|
|
|
return $this->code; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* Set learningOutcome |
|
201
|
|
|
* |
|
202
|
|
|
* @param LearningOutcome $learningOutcome |
|
203
|
|
|
* |
|
204
|
|
|
* @return Activity |
|
205
|
|
|
*/ |
|
206
|
|
|
public function setLearningOutcome(LearningOutcome $learningOutcome) |
|
207
|
|
|
{ |
|
208
|
|
|
$this->learningOutcome = $learningOutcome; |
|
209
|
|
|
|
|
210
|
|
|
return $this; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* Get learningOutcome |
|
215
|
|
|
* |
|
216
|
|
|
* @return LearningOutcome |
|
217
|
|
|
*/ |
|
218
|
|
|
public function getLearningOutcome() |
|
219
|
|
|
{ |
|
220
|
|
|
return $this->learningOutcome; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Add criterion |
|
225
|
|
|
* |
|
226
|
|
|
* @param Criterion $criterion |
|
227
|
|
|
* |
|
228
|
|
|
* @return Activity |
|
229
|
|
|
*/ |
|
230
|
|
|
public function addCriterium(Criterion $criterion) |
|
231
|
|
|
{ |
|
232
|
|
|
$this->criteria[] = $criterion; |
|
233
|
|
|
|
|
234
|
|
|
return $this; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Remove criterion |
|
239
|
|
|
* |
|
240
|
|
|
* @param Criterion $criterion |
|
241
|
|
|
*/ |
|
242
|
|
|
public function removeCriterium(Criterion $criterion) |
|
243
|
|
|
{ |
|
244
|
|
|
$this->criteria->removeElement($criterion); |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Get criteria |
|
249
|
|
|
* |
|
250
|
|
|
* @return Collection |
|
251
|
|
|
*/ |
|
252
|
|
|
public function getCriteria() |
|
253
|
|
|
{ |
|
254
|
|
|
return $this->criteria; |
|
255
|
|
|
} |
|
256
|
|
|
} |
|
257
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.