|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Copyright 2014-2016 Arnaud Bienvenu |
|
4
|
|
|
* |
|
5
|
|
|
* This file is part of Kyela. |
|
6
|
|
|
|
|
7
|
|
|
* Kyela is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU Affero General Public License as published by |
|
9
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
10
|
|
|
* (at your option) any later version. |
|
11
|
|
|
|
|
12
|
|
|
* Kyela is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
|
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
* along with Kyela. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace Abienvenu\KyelaBundle\Entity; |
|
23
|
|
|
|
|
24
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
25
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Comment |
|
29
|
|
|
* |
|
30
|
|
|
* @ORM\Table() |
|
31
|
|
|
* @ORM\Entity(repositoryClass="Abienvenu\KyelaBundle\Entity\CommentRepository") |
|
32
|
|
|
*/ |
|
33
|
|
|
class Comment extends Entity |
|
34
|
|
|
{ |
|
35
|
|
|
/** |
|
36
|
|
|
* @var integer |
|
37
|
|
|
* |
|
38
|
|
|
* @ORM\Column(name="id", type="integer") |
|
39
|
|
|
* @ORM\Id |
|
40
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
41
|
|
|
*/ |
|
42
|
|
|
private $id; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
* |
|
47
|
|
|
* @ORM\Column(name="author", type="string", length=255) |
|
48
|
|
|
*/ |
|
49
|
|
|
private $author; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string |
|
53
|
|
|
* |
|
54
|
|
|
* @ORM\Column(name="content", type="string", length=5000) |
|
55
|
|
|
* @Assert\NotBlank() |
|
56
|
|
|
*/ |
|
57
|
|
|
private $content; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var \DateTime |
|
61
|
|
|
* |
|
62
|
|
|
* @ORM\Column(name="datetime", type="datetime") |
|
63
|
|
|
*/ |
|
64
|
|
|
private $datetime; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @ORM\ManyToOne(targetEntity="Poll", inversedBy="comments") |
|
68
|
|
|
*/ |
|
69
|
|
|
private $poll; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Get id |
|
73
|
|
|
* |
|
74
|
|
|
* @return integer |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getId() |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->id; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Set author |
|
83
|
|
|
* |
|
84
|
|
|
* @param string $author |
|
85
|
|
|
* @return Comment |
|
86
|
|
|
*/ |
|
87
|
|
|
public function setAuthor($author) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->author = $author; |
|
90
|
|
|
|
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Get author |
|
96
|
|
|
* |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getAuthor() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->author; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Set content |
|
106
|
|
|
* |
|
107
|
|
|
* @param string $content |
|
108
|
|
|
* @return Comment |
|
109
|
|
|
*/ |
|
110
|
|
|
public function setContent($content) |
|
111
|
|
|
{ |
|
112
|
|
|
$this->content = $content; |
|
113
|
|
|
|
|
114
|
|
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Get content |
|
119
|
|
|
* |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getContent() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->content; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Set datetime |
|
129
|
|
|
* |
|
130
|
|
|
* @param \DateTime $datetime |
|
131
|
|
|
* @return Comment |
|
132
|
|
|
*/ |
|
133
|
|
|
public function setDatetime($datetime) |
|
134
|
|
|
{ |
|
135
|
|
|
$this->datetime = $datetime; |
|
136
|
|
|
|
|
137
|
|
|
return $this; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Get datetime |
|
142
|
|
|
* |
|
143
|
|
|
* @return \DateTime |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getDatetime() |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->datetime; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Set poll |
|
152
|
|
|
* |
|
153
|
|
|
* @param Poll $poll |
|
154
|
|
|
* @return Comment |
|
155
|
|
|
*/ |
|
156
|
|
|
public function setPoll(Poll $poll = null) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->poll = $poll; |
|
159
|
|
|
|
|
160
|
|
|
return $this; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* Get poll |
|
165
|
|
|
* |
|
166
|
|
|
* @return Poll |
|
167
|
|
|
*/ |
|
168
|
|
|
public function getPoll() |
|
169
|
|
|
{ |
|
170
|
|
|
return $this->poll; |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
|