1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Kreta package. |
5
|
|
|
* |
6
|
|
|
* (c) Beñat Espiña <[email protected]> |
7
|
|
|
* (c) Gorka Laucirica <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
10
|
|
|
* file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Kreta\Component\Comment\Model; |
14
|
|
|
|
15
|
|
|
use Kreta\Component\Comment\Model\Interfaces\CommentInterface; |
16
|
|
|
use Kreta\Component\Core\Model\Abstracts\AbstractModel; |
17
|
|
|
use Kreta\Component\Issue\Model\Interfaces\IssueInterface; |
18
|
|
|
use Kreta\Component\User\Model\Interfaces\UserInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class Comment. |
22
|
|
|
* |
23
|
|
|
* @author Beñat Espiña <[email protected]> |
24
|
|
|
* @author Gorka Laucirica <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
class Comment extends AbstractModel implements CommentInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Created at. |
30
|
|
|
* |
31
|
|
|
* @var \DateTime |
32
|
|
|
*/ |
33
|
|
|
protected $createdAt; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The description. |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $description; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The issue. |
44
|
|
|
* |
45
|
|
|
* @var \Kreta\Component\Issue\Model\Interfaces\IssueInterface |
46
|
|
|
*/ |
47
|
|
|
protected $issue; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Created at. |
51
|
|
|
* |
52
|
|
|
* @var \DateTime |
53
|
|
|
*/ |
54
|
|
|
protected $updatedAt; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The owner. |
58
|
|
|
* |
59
|
|
|
* @var \Symfony\Component\Security\Core\User\UserInterface |
60
|
|
|
*/ |
61
|
|
|
protected $writtenBy; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Constructor. |
65
|
|
|
*/ |
66
|
|
|
public function __construct() |
67
|
|
|
{ |
68
|
|
|
$this->createdAt = new \DateTime(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* {@inheritdoc} |
73
|
|
|
*/ |
74
|
|
|
public function getCreatedAt() |
75
|
|
|
{ |
76
|
|
|
return $this->createdAt; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* {@inheritdoc} |
81
|
|
|
*/ |
82
|
|
|
public function setCreatedAt(\DateTime $createdAt) |
83
|
|
|
{ |
84
|
|
|
$this->createdAt = $createdAt; |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* {@inheritdoc} |
91
|
|
|
*/ |
92
|
|
|
public function getDescription() |
93
|
|
|
{ |
94
|
|
|
return $this->description; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* {@inheritdoc} |
99
|
|
|
*/ |
100
|
|
|
public function setDescription($description) |
101
|
|
|
{ |
102
|
|
|
$this->description = $description; |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* {@inheritdoc} |
109
|
|
|
*/ |
110
|
|
|
public function getIssue() |
111
|
|
|
{ |
112
|
|
|
return $this->issue; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* {@inheritdoc} |
117
|
|
|
*/ |
118
|
|
|
public function setIssue(IssueInterface $issue) |
119
|
|
|
{ |
120
|
|
|
$this->issue = $issue; |
121
|
|
|
|
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* {@inheritdoc} |
127
|
|
|
*/ |
128
|
|
|
public function getUpdatedAt() |
129
|
|
|
{ |
130
|
|
|
return $this->updatedAt; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* {@inheritdoc} |
135
|
|
|
*/ |
136
|
|
|
public function setUpdatedAt(\DateTime $updatedAt) |
137
|
|
|
{ |
138
|
|
|
$this->updatedAt = $updatedAt; |
139
|
|
|
|
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* {@inheritdoc} |
145
|
|
|
*/ |
146
|
|
|
public function getWrittenBy() |
147
|
|
|
{ |
148
|
|
|
return $this->writtenBy; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* {@inheritdoc} |
153
|
|
|
*/ |
154
|
|
|
public function setWrittenBy(UserInterface $writtenBy) |
155
|
|
|
{ |
156
|
|
|
$this->writtenBy = $writtenBy; |
157
|
|
|
|
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
} |
161
|
|
|
|