Completed
Push — master ( 6f5084...9b811e )
by Julito
14:55
created

CStudentPublicationComment::getComment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Entity;
5
6
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
7
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
8
use Doctrine\ORM\Mapping as ORM;
9
10
/**
11
 * CStudentPublicationComment.
12
 *
13
 * @ORM\Table(
14
 *  name="c_student_publication_comment",
15
 *  indexes={
16
 *      @ORM\Index(name="course", columns={"c_id"}),
17
 *      @ORM\Index(name="user", columns={"user_id"}),
18
 *      @ORM\Index(name="work", columns={"work_id"})
19
 *  }
20
 * )
21
 * @ORM\Entity
22
 */
23
class CStudentPublicationComment extends AbstractResource implements ResourceInterface
24
{
25
    /**
26
     * @var int
27
     *
28
     * @ORM\Column(name="iid", type="integer")
29
     * @ORM\Id
30
     * @ORM\GeneratedValue
31
     */
32
    protected $iid;
33
34
    /**
35
     * @var int
36
     *
37
     * @ORM\Column(name="c_id", type="integer")
38
     */
39
    protected $cId;
40
41
    /**
42
     * @var int
43
     *
44
     * @ORM\Column(name="id", type="integer", nullable=true)
45
     */
46
    protected $id;
47
48
    /**
49
     * @var int
50
     *
51
     * @ORM\Column(name="work_id", type="integer", nullable=false)
52
     */
53
    protected $workId;
54
55
    /**
56
     * @var string
57
     *
58
     * @ORM\Column(name="comment", type="text", nullable=true)
59
     */
60
    protected $comment;
61
62
    /**
63
     * @var string
64
     *
65
     * @ORM\Column(name="file", type="string", length=255, nullable=true)
66
     */
67
    protected $file;
68
69
    /**
70
     * @var int
71
     *
72
     * @ORM\Column(name="user_id", type="integer", nullable=false)
73
     */
74
    protected $userId;
75
76
    /**
77
     * @var \DateTime
78
     *
79
     * @ORM\Column(name="sent_at", type="datetime", nullable=false)
80
     */
81
    protected $sentAt;
82
83
    public function __construct()
84
    {
85
        $this->sentAt = new \DateTime();
86
    }
87
88
    public function __toString(): string
89
    {
90
        return (string) $this->getIid();
91
    }
92
93
    /**
94
     * @return int
95
     */
96
    public function getIid()
97
    {
98
        return $this->iid;
99
    }
100
101
    /**
102
     * @return int
103
     */
104
    public function setId($id)
105
    {
106
        $this->id = $id;
107
108
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Chamilo\CourseBundle\Ent...udentPublicationComment which is incompatible with the documented return type integer.
Loading history...
109
    }
110
111
    /**
112
     * Set workId.
113
     *
114
     * @param int $workId
115
     *
116
     * @return CStudentPublicationComment
117
     */
118
    public function setWorkId($workId)
119
    {
120
        $this->workId = $workId;
121
122
        return $this;
123
    }
124
125
    /**
126
     * Get workId.
127
     *
128
     * @return int
129
     */
130
    public function getWorkId()
131
    {
132
        return $this->workId;
133
    }
134
135
    /**
136
     * Set cId.
137
     *
138
     * @param int $cId
139
     *
140
     * @return CStudentPublicationComment
141
     */
142
    public function setCId($cId)
143
    {
144
        $this->cId = $cId;
145
146
        return $this;
147
    }
148
149
    /**
150
     * Get cId.
151
     *
152
     * @return int
153
     */
154
    public function getCId()
155
    {
156
        return $this->cId;
157
    }
158
159
    /**
160
     * Set comment.
161
     *
162
     * @param string $comment
163
     *
164
     * @return CStudentPublicationComment
165
     */
166
    public function setComment($comment)
167
    {
168
        $this->comment = $comment;
169
170
        return $this;
171
    }
172
173
    /**
174
     * Get comment.
175
     *
176
     * @return string
177
     */
178
    public function getComment()
179
    {
180
        return $this->comment;
181
    }
182
183
    /**
184
     * Set file.
185
     *
186
     * @param string $file
187
     *
188
     * @return CStudentPublicationComment
189
     */
190
    public function setFile($file)
191
    {
192
        $this->file = $file;
193
194
        return $this;
195
    }
196
197
    /**
198
     * Get file.
199
     *
200
     * @return string
201
     */
202
    public function getFile()
203
    {
204
        return $this->file;
205
    }
206
207
    /**
208
     * Set userId.
209
     *
210
     * @param int $userId
211
     *
212
     * @return CStudentPublicationComment
213
     */
214
    public function setUserId($userId)
215
    {
216
        $this->userId = $userId;
217
218
        return $this;
219
    }
220
221
    /**
222
     * Get userId.
223
     *
224
     * @return int
225
     */
226
    public function getUserId()
227
    {
228
        return $this->userId;
229
    }
230
231
    /**
232
     * Set sentAt.
233
     *
234
     * @param \DateTime $sentAt
235
     *
236
     * @return CStudentPublicationComment
237
     */
238
    public function setSentAt($sentAt)
239
    {
240
        $this->sentAt = $sentAt;
241
242
        return $this;
243
    }
244
245
    /**
246
     * Get sentAt.
247
     *
248
     * @return \DateTime
249
     */
250
    public function getSentAt()
251
    {
252
        return $this->sentAt;
253
    }
254
255
    /**
256
     * Get id.
257
     *
258
     * @return int
259
     */
260
    public function getId()
261
    {
262
        return $this->id;
263
    }
264
265
    /**
266
     * Resource identifier.
267
     */
268
    public function getResourceIdentifier(): int
269
    {
270
        return $this->getIid();
271
    }
272
273
    public function getResourceName(): string
274
    {
275
        return (string) substr($this->getComment(), 0, 80);
276
    }
277
}
278