Passed
Push — master ( fc8817...f91339 )
by Angel Fernando Quiroz
10:10 queued 10s
created

CarePost   A

Complexity

Total Complexity 31

Size/Duplication

Total Lines 388
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 64
dl 0
loc 388
rs 9.92
c 0
b 0
f 0
wmc 31

30 Methods

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