Passed
Push — master ( bfc3ee...241b61 )
by Julito
10:52
created

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