]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Entry.php
rename User entity
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Entity;
4
5 use Doctrine\ORM\Mapping as ORM;
6 use Symfony\Component\Validator\Constraints as Assert;
7
8 /**
9 * Entry
10 *
11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
12 * @ORM\Table(name="entry")
13 * @ORM\HasLifecycleCallbacks()
14 *
15 */
16 class Entry
17 {
18 /**
19 * @var integer
20 *
21 * @ORM\Column(name="id", type="integer")
22 * @ORM\Id
23 * @ORM\GeneratedValue(strategy="AUTO")
24 */
25 private $id;
26
27 /**
28 * @var string
29 *
30 * @ORM\Column(name="title", type="text", nullable=true)
31 */
32 private $title;
33
34 /**
35 * @var string
36 *
37 * @Assert\NotBlank()
38 * @ORM\Column(name="url", type="text", nullable=true)
39 */
40 private $url;
41
42 /**
43 * @var boolean
44 *
45 * @ORM\Column(name="is_archived", type="boolean")
46 */
47 private $isArchived = false;
48
49 /**
50 * @var boolean
51 *
52 * @ORM\Column(name="is_starred", type="boolean")
53 */
54 private $isStarred = false;
55
56 /**
57 * @var boolean
58 *
59 * @ORM\Column(name="is_deleted", type="boolean")
60 */
61 private $isDeleted = false;
62
63 /**
64 * @var string
65 *
66 * @ORM\Column(name="content", type="text", nullable=true)
67 */
68 private $content;
69
70 /**
71 * @var date
72 *
73 * @ORM\Column(name="created_at", type="datetime")
74 */
75 private $createdAt;
76
77 /**
78 * @var date
79 *
80 * @ORM\Column(name="updated_at", type="datetime")
81 */
82 private $updatedAt;
83
84 /**
85 * @var string
86 *
87 * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
88 */
89 private $userId;
90
91 /**
92 * @var string
93 *
94 * @ORM\Column(name="comments", type="text", nullable=true)
95 */
96 private $comments;
97
98 /**
99 * @var string
100 *
101 * @ORM\Column(name="mimetype", type="text", nullable=true)
102 */
103 private $mimetype;
104
105 /**
106 * @var integer
107 *
108 * @ORM\Column(name="reading_type", type="integer", nullable=true)
109 */
110 private $readingTime;
111
112 /**
113 * @var string
114 *
115 * @ORM\Column(name="domain_name", type="text", nullable=true)
116 */
117 private $domainName;
118
119 /**
120 * @var boolean
121 *
122 * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false})
123 */
124 private $isPublic;
125
126 /**
127 * Get id
128 *
129 * @return integer
130 */
131 public function getId()
132 {
133 return $this->id;
134 }
135
136 /**
137 * Set title
138 *
139 * @param string $title
140 * @return Entry
141 */
142 public function setTitle($title)
143 {
144 $this->title = $title;
145
146 return $this;
147 }
148
149 /**
150 * Get title
151 *
152 * @return string
153 */
154 public function getTitle()
155 {
156 return $this->title;
157 }
158
159 /**
160 * Set url
161 *
162 * @param string $url
163 * @return Entry
164 */
165 public function setUrl($url)
166 {
167 $this->url = $url;
168
169 return $this;
170 }
171
172 /**
173 * Get url
174 *
175 * @return string
176 */
177 public function getUrl()
178 {
179 return $this->url;
180 }
181
182 /**
183 * Set isArchived
184 *
185 * @param string $isArchived
186 * @return Entry
187 */
188 public function setArchived($isArchived)
189 {
190 $this->isArchived = $isArchived;
191
192 return $this;
193 }
194
195 /**
196 * Get isArchived
197 *
198 * @return string
199 */
200 public function isArchived()
201 {
202 return $this->isArchived;
203 }
204
205 public function toggleArchive()
206 {
207 $this->isArchived = $this->isArchived() ^ 1;
208
209 return $this;
210 }
211
212 /**
213 * Set isStarred
214 *
215 * @param string $isStarred
216 * @return Entry
217 */
218 public function setStarred($isStarred)
219 {
220 $this->isStarred = $isStarred;
221
222 return $this;
223 }
224
225 /**
226 * Get isStarred
227 *
228 * @return string
229 */
230 public function isStarred()
231 {
232 return $this->isStarred;
233 }
234
235 public function toggleStar()
236 {
237 $this->isStarred = $this->isStarred() ^ 1;
238
239 return $this;
240 }
241
242 /**
243 * Set content
244 *
245 * @param string $content
246 * @return Entry
247 */
248 public function setContent($content)
249 {
250 $this->content = $content;
251
252 return $this;
253 }
254
255 /**
256 * Get content
257 *
258 * @return string
259 */
260 public function getContent()
261 {
262 return $this->content;
263 }
264
265 /**
266 * Set userId
267 *
268 * @param string $userId
269 * @return Entry
270 */
271 public function setUserId($userId)
272 {
273 $this->userId = $userId;
274
275 return $this;
276 }
277
278 /**
279 * Get userId
280 *
281 * @return string
282 */
283 public function getUserId()
284 {
285 return $this->userId;
286 }
287
288 /**
289 * @return string
290 */
291 public function isDeleted()
292 {
293 return $this->isDeleted;
294 }
295
296 /**
297 * @param string $isDeleted
298 */
299 public function setDeleted($isDeleted)
300 {
301 $this->isDeleted = $isDeleted;
302 }
303
304 /**
305 * @return string
306 */
307 public function getCreatedAt()
308 {
309 return $this->createdAt;
310 }
311
312 /**
313 * @return string
314 */
315 public function getUpdatedAt()
316 {
317 return $this->updatedAt;
318 }
319
320 /**
321 * @ORM\PrePersist
322 * @ORM\PreUpdate
323 */
324 public function timestamps()
325 {
326 if (is_null($this->createdAt)) {
327 $this->createdAt = new \DateTime();
328 }
329
330 $this->updatedAt = new \DateTime();
331 }
332
333 /**
334 * @return string
335 */
336 public function getComments()
337 {
338 return $this->comments;
339 }
340
341 /**
342 * @param string $comments
343 */
344 public function setComments($comments)
345 {
346 $this->comments = $comments;
347 }
348
349 /**
350 * @return string
351 */
352 public function getMimetype()
353 {
354 return $this->mimetype;
355 }
356
357 /**
358 * @param string $mimetype
359 */
360 public function setMimetype($mimetype)
361 {
362 $this->mimetype = $mimetype;
363 }
364
365 /**
366 * @return int
367 */
368 public function getReadingTime()
369 {
370 return $this->readingTime;
371 }
372
373 /**
374 * @param int $readingTime
375 */
376 public function setReadingTime($readingTime)
377 {
378 $this->readingTime = $readingTime;
379 }
380
381 /**
382 * @return string
383 */
384 public function getDomainName()
385 {
386 return $this->domainName;
387 }
388
389 /**
390 * @param string $domainName
391 */
392 public function setDomainName($domainName)
393 {
394 $this->domainName = $domainName;
395 }
396
397 /**
398 * @return boolean
399 */
400 public function isPublic()
401 {
402 return $this->isPublic;
403 }
404
405 /**
406 * @param boolean $isPublic
407 */
408 public function setPublic($isPublic)
409 {
410 $this->isPublic = $isPublic;
411 }
412 }