Passed
Push — master ( db53d7...84ebef )
by Julito
09:47
created

CAnnouncement   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 214
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 32
dl 0
loc 214
rs 10
c 1
b 0
f 0
wmc 18

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getDisplayOrder() 0 3 1
A setDisplayOrder() 0 5 1
A getEndDate() 0 3 1
A setEndDate() 0 5 1
A getResourceName() 0 3 1
A setResourceName() 0 3 1
A getResourceIdentifier() 0 3 1
A getAttachments() 0 3 1
A setContent() 0 5 1
A setEmailSent() 0 5 1
A setTitle() 0 5 1
A getContent() 0 3 1
A __toString() 0 3 1
A __construct() 0 3 1
A setAttachments() 0 5 1
A getEmailSent() 0 3 1
A getTitle() 0 3 1
A getIid() 0 3 1
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\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * CAnnouncement.
15
 *
16
 * @ORM\Table(name="c_announcement")
17
 * @ORM\Entity
18
 */
19
class CAnnouncement extends AbstractResource implements ResourceInterface
20
{
21
    /**
22
     * @var int
23
     *
24
     * @ORM\Column(name="iid", type="integer")
25
     * @ORM\Id
26
     * @ORM\GeneratedValue
27
     */
28
    protected $iid;
29
30
    /**
31
     * @var string
32
     *
33
     * @Assert\NotBlank()
34
     *
35
     * @ORM\Column(name="title", type="text", nullable=true)
36
     */
37
    protected $title;
38
39
    /**
40
     * @var string
41
     *
42
     * @ORM\Column(name="content", type="text", nullable=true)
43
     */
44
    protected $content;
45
46
    /**
47
     * @var \DateTime
48
     *
49
     * @ORM\Column(name="end_date", type="date", nullable=true)
50
     */
51
    protected $endDate;
52
53
    /**
54
     * @var int
55
     *
56
     * @ORM\Column(name="display_order", type="integer", nullable=false)
57
     */
58
    protected $displayOrder;
59
60
    /**
61
     * @var bool
62
     *
63
     * @ORM\Column(name="email_sent", type="boolean", nullable=true)
64
     */
65
    protected $emailSent;
66
67
    /**
68
     * @var ArrayCollection|CAnnouncementAttachment[]
69
     *
70
     * @ORM\OneToMany(
71
     *     targetEntity="CAnnouncementAttachment",
72
     *     mappedBy="announcement", cascade={"persist", "remove"}, orphanRemoval=true
73
     * )
74
     */
75
    protected $attachments;
76
77
    public function __construct()
78
    {
79
        $this->attachments = new ArrayCollection();
80
    }
81
82
    public function __toString(): string
83
    {
84
        return $this->getTitle();
85
    }
86
87
    public function getAttachments()
88
    {
89
        return $this->attachments;
90
    }
91
92
    /**
93
     * @param CAnnouncementAttachment[] $attachments
94
     */
95
    public function setAttachments(array $attachments): self
96
    {
97
        $this->attachments = $attachments;
98
99
        return $this;
100
    }
101
102
    /**
103
     * Set title.
104
     *
105
     * @param string $title
106
     */
107
    public function setTitle($title): self
108
    {
109
        $this->title = $title;
110
111
        return $this;
112
    }
113
114
    /**
115
     * Get title.
116
     *
117
     * @return string
118
     */
119
    public function getTitle()
120
    {
121
        return (string) $this->title;
122
    }
123
124
    /**
125
     * Set content.
126
     *
127
     * @param string $content
128
     */
129
    public function setContent($content): self
130
    {
131
        $this->content = $content;
132
133
        return $this;
134
    }
135
136
    /**
137
     * Get content.
138
     *
139
     * @return string
140
     */
141
    public function getContent()
142
    {
143
        return $this->content;
144
    }
145
146
    /**
147
     * Set endDate.
148
     *
149
     * @param \DateTime $endDate
150
     */
151
    public function setEndDate($endDate): self
152
    {
153
        $this->endDate = $endDate;
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get endDate.
160
     *
161
     * @return \DateTime
162
     */
163
    public function getEndDate()
164
    {
165
        return $this->endDate;
166
    }
167
168
    /**
169
     * Set displayOrder.
170
     *
171
     * @param int $displayOrder
172
     */
173
    public function setDisplayOrder($displayOrder): self
174
    {
175
        $this->displayOrder = $displayOrder;
176
177
        return $this;
178
    }
179
180
    /**
181
     * Get displayOrder.
182
     *
183
     * @return int
184
     */
185
    public function getDisplayOrder()
186
    {
187
        return $this->displayOrder;
188
    }
189
190
    /**
191
     * Set emailSent.
192
     *
193
     * @param bool $emailSent
194
     */
195
    public function setEmailSent($emailSent): self
196
    {
197
        $this->emailSent = $emailSent;
198
199
        return $this;
200
    }
201
202
    /**
203
     * Get emailSent.
204
     *
205
     * @return bool
206
     */
207
    public function getEmailSent()
208
    {
209
        return $this->emailSent;
210
    }
211
212
    public function getIid(): int
213
    {
214
        return $this->iid;
215
    }
216
217
    /**
218
     * Resource identifier.
219
     */
220
    public function getResourceIdentifier(): int
221
    {
222
        return $this->getIid();
223
    }
224
225
    public function getResourceName(): string
226
    {
227
        return $this->getTitle();
228
    }
229
230
    public function setResourceName(string $name): self
231
    {
232
        return $this->setTitle($name);
233
    }
234
}
235