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