1
|
|
|
<?php |
2
|
|
|
/* For licensing terms, see /license.txt */ |
3
|
|
|
|
4
|
|
|
namespace Chamilo\PluginBundle\Entity\StudentFollowUp; |
5
|
|
|
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* CarePost. |
11
|
|
|
* |
12
|
|
|
* @ORM\Table(name="sfu_post") |
13
|
|
|
* @ORM\Entity |
14
|
|
|
* @Gedmo\Tree(type="nested") |
15
|
|
|
*/ |
16
|
|
|
class CarePost |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var int |
20
|
|
|
* |
21
|
|
|
* @ORM\Column(name="id", type="integer") |
22
|
|
|
* @ORM\Id |
23
|
|
|
* @ORM\GeneratedValue |
24
|
|
|
*/ |
25
|
|
|
protected $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
* |
30
|
|
|
* @ORM\Column(name="title", type="string", length=255, nullable=false) |
31
|
|
|
*/ |
32
|
|
|
protected $title; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
* |
37
|
|
|
* @ORM\Column(name="content", type="text", nullable=true) |
38
|
|
|
*/ |
39
|
|
|
protected $content; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(name="external_care_id", type="string", nullable=true) |
45
|
|
|
*/ |
46
|
|
|
protected $externalCareId; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @ORM\Column(name="created_at", type="datetime", nullable=true) |
50
|
|
|
*/ |
51
|
|
|
protected $createdAt; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @ORM\Column(name="updated_at", type="datetime", nullable=true) |
55
|
|
|
*/ |
56
|
|
|
protected $updatedAt; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var bool |
60
|
|
|
* |
61
|
|
|
* @ORM\Column(name="private", type="boolean") |
62
|
|
|
*/ |
63
|
|
|
protected $private; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var bool |
67
|
|
|
* |
68
|
|
|
* @ORM\Column(name="external_source", type="boolean") |
69
|
|
|
*/ |
70
|
|
|
protected $externalSource; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var array |
74
|
|
|
* |
75
|
|
|
* @ORM\Column(name="tags", type="array") |
76
|
|
|
*/ |
77
|
|
|
protected $tags; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var string |
81
|
|
|
* |
82
|
|
|
* @ORM\Column(name="attachment", type="string", length=255) |
83
|
|
|
*/ |
84
|
|
|
protected $attachment; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", cascade={"persist"}) |
88
|
|
|
* @ORM\JoinColumn(name="insert_user_id", referencedColumnName="id", nullable=false) |
89
|
|
|
*/ |
90
|
|
|
private $insertUser; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", cascade={"persist"}) |
94
|
|
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) |
95
|
|
|
*/ |
96
|
|
|
private $user; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @Gedmo\TreeParent |
100
|
|
|
* @ORM\ManyToOne(targetEntity="CarePost", inversedBy="children") |
101
|
|
|
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL") |
102
|
|
|
*/ |
103
|
|
|
private $parent; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @ORM\OneToMany(targetEntity="CarePost", mappedBy="parent") |
107
|
|
|
* @ORM\OrderBy({"createdAt" = "DESC"}) |
108
|
|
|
*/ |
109
|
|
|
private $children; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var int |
113
|
|
|
* @Gedmo\TreeLeft |
114
|
|
|
* @ORM\Column(name="lft", type="integer", nullable=true, unique=false) |
115
|
|
|
*/ |
116
|
|
|
private $lft; |
|
|
|
|
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @var int |
120
|
|
|
* @Gedmo\TreeRight |
121
|
|
|
* @ORM\Column(name="rgt", type="integer", nullable=true, unique=false) |
122
|
|
|
*/ |
123
|
|
|
private $rgt; |
|
|
|
|
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @var int |
127
|
|
|
* @Gedmo\TreeLevel |
128
|
|
|
* @ORM\Column(name="lvl", type="integer", nullable=true, unique=false) |
129
|
|
|
*/ |
130
|
|
|
private $lvl; |
|
|
|
|
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @var int |
134
|
|
|
* @Gedmo\TreeRoot |
135
|
|
|
* @ORM\Column(name="root", type="integer", nullable=true, unique=false) |
136
|
|
|
*/ |
137
|
|
|
private $root; |
|
|
|
|
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Project constructor. |
141
|
|
|
*/ |
142
|
|
|
public function __construct() |
143
|
|
|
{ |
144
|
|
|
$this->createdAt = new \DateTime(); |
145
|
|
|
$this->attachment = ''; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return int |
150
|
|
|
*/ |
151
|
|
|
public function getId() |
152
|
|
|
{ |
153
|
|
|
return $this->id; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param int $id |
158
|
|
|
* |
159
|
|
|
* @return $this |
160
|
|
|
*/ |
161
|
|
|
public function setId($id) |
162
|
|
|
{ |
163
|
|
|
$this->id = $id; |
164
|
|
|
|
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @return string |
170
|
|
|
*/ |
171
|
|
|
public function getTitle() |
172
|
|
|
{ |
173
|
|
|
return $this->title; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @param string $title |
178
|
|
|
* |
179
|
|
|
* @return CarePost |
180
|
|
|
*/ |
181
|
|
|
public function setTitle($title) |
182
|
|
|
{ |
183
|
|
|
$this->title = $title; |
184
|
|
|
|
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return string |
190
|
|
|
*/ |
191
|
|
|
public function getContent() |
192
|
|
|
{ |
193
|
|
|
return $this->content; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @param string $content |
198
|
|
|
* |
199
|
|
|
* @return CarePost |
200
|
|
|
*/ |
201
|
|
|
public function setContent($content) |
202
|
|
|
{ |
203
|
|
|
$this->content = $content; |
204
|
|
|
|
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @return string |
210
|
|
|
*/ |
211
|
|
|
public function getExternalCareId() |
212
|
|
|
{ |
213
|
|
|
return $this->externalCareId; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @param string $externalCareId |
218
|
|
|
* |
219
|
|
|
* @return CarePost |
220
|
|
|
*/ |
221
|
|
|
public function setExternalCareId($externalCareId) |
222
|
|
|
{ |
223
|
|
|
$this->externalCareId = $externalCareId; |
224
|
|
|
|
225
|
|
|
return $this; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @return mixed |
230
|
|
|
*/ |
231
|
|
|
public function getUser() |
232
|
|
|
{ |
233
|
|
|
return $this->user; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* @param mixed $user |
238
|
|
|
* |
239
|
|
|
* @return CarePost |
240
|
|
|
*/ |
241
|
|
|
public function setUser($user) |
242
|
|
|
{ |
243
|
|
|
$this->user = $user; |
244
|
|
|
|
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* @return bool |
250
|
|
|
*/ |
251
|
|
|
public function isPrivate() |
252
|
|
|
{ |
253
|
|
|
return $this->private; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @param bool $private |
258
|
|
|
* |
259
|
|
|
* @return CarePost |
260
|
|
|
*/ |
261
|
|
|
public function setPrivate($private) |
262
|
|
|
{ |
263
|
|
|
$this->private = $private; |
264
|
|
|
|
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @return bool |
270
|
|
|
*/ |
271
|
|
|
public function isExternalSource() |
272
|
|
|
{ |
273
|
|
|
return $this->externalSource; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @param bool $externalSource |
278
|
|
|
* |
279
|
|
|
* @return CarePost |
280
|
|
|
*/ |
281
|
|
|
public function setExternalSource($externalSource) |
282
|
|
|
{ |
283
|
|
|
$this->externalSource = $externalSource; |
284
|
|
|
|
285
|
|
|
return $this; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @return string |
290
|
|
|
*/ |
291
|
|
|
public function getAttachment() |
292
|
|
|
{ |
293
|
|
|
return $this->attachment; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @param string $attachment |
298
|
|
|
* |
299
|
|
|
* @return CarePost |
300
|
|
|
*/ |
301
|
|
|
public function setAttachment($attachment) |
302
|
|
|
{ |
303
|
|
|
$this->attachment = $attachment; |
304
|
|
|
|
305
|
|
|
return $this; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* @return mixed |
310
|
|
|
*/ |
311
|
|
|
public function getParent() |
312
|
|
|
{ |
313
|
|
|
return $this->parent; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* @param mixed $parent |
318
|
|
|
* |
319
|
|
|
* @return CarePost |
320
|
|
|
*/ |
321
|
|
|
public function setParent($parent) |
322
|
|
|
{ |
323
|
|
|
$this->parent = $parent; |
324
|
|
|
|
325
|
|
|
return $this; |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @return int |
330
|
|
|
*/ |
331
|
|
|
public function hasParent() |
332
|
|
|
{ |
333
|
|
|
return !empty($this->parent) ? 1 : 0; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* @return mixed |
338
|
|
|
*/ |
339
|
|
|
public function getChildren() |
340
|
|
|
{ |
341
|
|
|
return $this->children; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* @param mixed $children |
346
|
|
|
* |
347
|
|
|
* @return CarePost |
348
|
|
|
*/ |
349
|
|
|
public function setChildren($children) |
350
|
|
|
{ |
351
|
|
|
$this->children = $children; |
352
|
|
|
|
353
|
|
|
return $this; |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
/** |
357
|
|
|
* @return mixed |
358
|
|
|
*/ |
359
|
|
|
public function getCreatedAt() |
360
|
|
|
{ |
361
|
|
|
return $this->createdAt; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @param mixed $createdAt |
366
|
|
|
* |
367
|
|
|
* @return CarePost |
368
|
|
|
*/ |
369
|
|
|
public function setCreatedAt($createdAt) |
370
|
|
|
{ |
371
|
|
|
$this->createdAt = $createdAt; |
372
|
|
|
|
373
|
|
|
return $this; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* @return mixed |
378
|
|
|
*/ |
379
|
|
|
public function getUpdatedAt() |
380
|
|
|
{ |
381
|
|
|
return $this->updatedAt; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* @param mixed $updatedAt |
386
|
|
|
* |
387
|
|
|
* @return CarePost |
388
|
|
|
*/ |
389
|
|
|
public function setUpdatedAt($updatedAt) |
390
|
|
|
{ |
391
|
|
|
$this->updatedAt = $updatedAt; |
392
|
|
|
|
393
|
|
|
return $this; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* @return array |
398
|
|
|
*/ |
399
|
|
|
public function getTags() |
400
|
|
|
{ |
401
|
|
|
return $this->tags; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* @param array $tags |
406
|
|
|
* |
407
|
|
|
* @return CarePost |
408
|
|
|
*/ |
409
|
|
|
public function setTags($tags) |
410
|
|
|
{ |
411
|
|
|
$this->tags = $tags; |
412
|
|
|
|
413
|
|
|
return $this; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* @return mixed |
418
|
|
|
*/ |
419
|
|
|
public function getInsertUser() |
420
|
|
|
{ |
421
|
|
|
return $this->insertUser; |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
425
|
|
|
* @param mixed $insertUser |
426
|
|
|
* |
427
|
|
|
* @return CarePost |
428
|
|
|
*/ |
429
|
|
|
public function setInsertUser($insertUser) |
430
|
|
|
{ |
431
|
|
|
$this->insertUser = $insertUser; |
432
|
|
|
|
433
|
|
|
return $this; |
434
|
|
|
} |
435
|
|
|
} |
436
|
|
|
|