]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Entity/Entry.php
Add user_created index
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
CommitLineData
9d50517c
NL
1<?php
2
ad4d1caa 3namespace Wallabag\CoreBundle\Entity;
9d50517c 4
0a018fe0 5use Doctrine\Common\Collections\ArrayCollection;
9d50517c 6use Doctrine\ORM\Mapping as ORM;
0f006880 7use Hateoas\Configuration\Annotation as Hateoas;
7d1fdab2 8use JMS\Serializer\Annotation\Exclude;
f808b016 9use JMS\Serializer\Annotation\Groups;
7d1fdab2 10use JMS\Serializer\Annotation\SerializedName;
f808b016
JB
11use JMS\Serializer\Annotation\VirtualProperty;
12use JMS\Serializer\Annotation\XmlRoot;
619cc453 13use Symfony\Component\Validator\Constraints as Assert;
4dc87223 14use Wallabag\AnnotationBundle\Entity\Annotation;
927c9e79 15use Wallabag\CoreBundle\Helper\EntityTimestampsTrait;
4a551637 16use Wallabag\CoreBundle\Helper\UrlHasher;
f808b016 17use Wallabag\UserBundle\Entity\User;
9d50517c
NL
18
19/**
4346a860 20 * Entry.
9d50517c 21 *
0f006880 22 * @XmlRoot("entry")
be463487 23 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
7e9c1d65
JB
24 * @ORM\Table(
25 * name="`entry`",
26 * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"},
81375151
NL
27 * indexes={
28 * @ORM\Index(name="created_at", columns={"created_at"}),
bfe02a0b 29 * @ORM\Index(name="uid", columns={"uid"}),
70df4c33 30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}),
d1dbe10e 31 * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}),
5071c8c9 32 * @ORM\Index(name="user_language", columns={"language", "user_id"}),
588de419 33 * @ORM\Index(name="user_archived", columns={"user_id", "is_archived", "archived_at"}),
2b0f4e86 34 * @ORM\Index(name="user_created", columns={"user_id", "created_at"}),
5071c8c9 35 * @ORM\Index(name="user_starred", columns={"user_id", "is_starred", "starred_at"})
81375151 36 * }
7e9c1d65 37 * )
34d15eb4 38 * @ORM\HasLifecycleCallbacks()
0f006880 39 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
9d50517c 40 */
be463487 41class Entry
9d50517c 42{
927c9e79
JB
43 use EntityTimestampsTrait;
44
0f006880 45 /** @Serializer\XmlAttribute */
9d50517c 46 /**
4346a860 47 * @var int
9d50517c 48 *
be463487 49 * @ORM\Column(name="id", type="integer")
9d50517c 50 * @ORM\Id
34d15eb4 51 * @ORM\GeneratedValue(strategy="AUTO")
5b7da076
TC
52 *
53 * @Groups({"entries_for_user", "export_all"})
9d50517c 54 */
be463487 55 private $id;
9d50517c 56
f3d0cb91 57 /**
78b3c31d 58 * @var string
f3d0cb91 59 *
7239082a 60 * @ORM\Column(name="uid", type="string", length=23, nullable=true)
f3d0cb91
NL
61 *
62 * @Groups({"entries_for_user", "export_all"})
63 */
7239082a 64 private $uid;
f3d0cb91 65
9d50517c
NL
66 /**
67 * @var string
68 *
69 * @ORM\Column(name="title", type="text", nullable=true)
5b7da076
TC
70 *
71 * @Groups({"entries_for_user", "export_all"})
9d50517c
NL
72 */
73 private $title;
74
75 /**
f3bfb875
JB
76 * Define the url fetched by wallabag (the final url after potential redirections).
77 *
9d50517c
NL
78 * @var string
79 *
b84a8055 80 * @Assert\NotBlank()
9d50517c 81 * @ORM\Column(name="url", type="text", nullable=true)
5b7da076
TC
82 *
83 * @Groups({"entries_for_user", "export_all"})
9d50517c
NL
84 */
85 private $url;
86
bfe02a0b
TC
87 /**
88 * @var string
89 *
8a645662 90 * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true)
bfe02a0b
TC
91 */
92 private $hashedUrl;
93
f3bfb875
JB
94 /**
95 * From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided).
96 *
97 * @var string
98 *
99 * @ORM\Column(name="origin_url", type="text", nullable=true)
5b7da076
TC
100 *
101 * @Groups({"entries_for_user", "export_all"})
9d50517c 102 */
f3bfb875 103 private $originUrl;
9d50517c 104
bfe02a0b 105 /**
f3bfb875
JB
106 * Define the url entered by the user (without redirections).
107 *
bfe02a0b
TC
108 * @var string
109 *
f3bfb875
JB
110 * @ORM\Column(name="given_url", type="text", nullable=true)
111 *
112 * @Groups({"entries_for_user", "export_all"})
bfe02a0b 113 */
f3bfb875
JB
114 private $givenUrl;
115
116 /**
117 * @var string
118 *
119 * @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true)
120 */
121 private $hashedGivenUrl;
bfe02a0b 122
9d50517c 123 /**
4346a860 124 * @var bool
9d50517c 125 *
189ef634
TC
126 * @Exclude
127 *
be463487 128 * @ORM\Column(name="is_archived", type="boolean")
5b7da076
TC
129 *
130 * @Groups({"entries_for_user", "export_all"})
9d50517c 131 */
905ae369 132 private $isArchived = false;
9d50517c 133
7975395d
SV
134 /**
135 * @var \DateTime
136 *
137 * @ORM\Column(name="archived_at", type="datetime", nullable=true)
138 *
139 * @Groups({"entries_for_user", "export_all"})
140 */
141 private $archivedAt = null;
142
9d50517c 143 /**
4346a860 144 * @var bool
9d50517c 145 *
189ef634
TC
146 * @Exclude
147 *
be463487 148 * @ORM\Column(name="is_starred", type="boolean")
5b7da076
TC
149 *
150 * @Groups({"entries_for_user", "export_all"})
9d50517c 151 */
905ae369 152 private $isStarred = false;
9d50517c 153
9d50517c
NL
154 /**
155 * @var string
156 *
eacaf7f8 157 * @ORM\Column(name="content", type="text", nullable=true)
5b7da076
TC
158 *
159 * @Groups({"entries_for_user", "export_all"})
9d50517c 160 */
eacaf7f8 161 private $content;
9d50517c 162
34d15eb4 163 /**
8664069e 164 * @var \DateTime
34d15eb4 165 *
be463487 166 * @ORM\Column(name="created_at", type="datetime")
5b7da076 167 *
9401696f 168 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
169 */
170 private $createdAt;
171
172 /**
8664069e 173 * @var \DateTime
34d15eb4 174 *
be463487 175 * @ORM\Column(name="updated_at", type="datetime")
5b7da076 176 *
9401696f 177 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
178 */
179 private $updatedAt;
180
5e9009ce
NL
181 /**
182 * @var \DateTime
183 *
184 * @ORM\Column(name="published_at", type="datetime", nullable=true)
185 *
186 * @Groups({"entries_for_user", "export_all"})
187 */
188 private $publishedAt;
189
7b0b3622
NL
190 /**
191 * @var array
192 *
1517d577 193 * @ORM\Column(name="published_by", type="array", nullable=true)
7b0b3622
NL
194 *
195 * @Groups({"entries_for_user", "export_all"})
196 */
197 private $publishedBy;
198
a991c46e
F
199 /**
200 * @var \DateTime
201 *
202 * @ORM\Column(name="starred_at", type="datetime", nullable=true)
203 *
204 * @Groups({"entries_for_user", "export_all"})
205 */
206 private $starredAt = null;
207
34d15eb4 208 /**
4dc87223 209 * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"})
f38e03dc 210 * @ORM\JoinTable
5b7da076 211 *
f38e03dc 212 * @Groups({"entries_for_user", "export_all"})
34d15eb4 213 */
4dc87223 214 private $annotations;
34d15eb4
NL
215
216 /**
217 * @var string
218 *
219 * @ORM\Column(name="mimetype", type="text", nullable=true)
5b7da076
TC
220 *
221 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
222 */
223 private $mimetype;
224
98f0929f
JB
225 /**
226 * @var string
227 *
d1dbe10e 228 * @ORM\Column(name="language", type="string", length=20, nullable=true)
5b7da076
TC
229 *
230 * @Groups({"entries_for_user", "export_all"})
98f0929f
JB
231 */
232 private $language;
233
34d15eb4 234 /**
4346a860 235 * @var int
34d15eb4 236 *
88bac4a3 237 * @ORM\Column(name="reading_time", type="integer", nullable=false)
5b7da076
TC
238 *
239 * @Groups({"entries_for_user", "export_all"})
34d15eb4 240 */
88bac4a3 241 private $readingTime = 0;
34d15eb4
NL
242
243 /**
244 * @var string
245 *
246 * @ORM\Column(name="domain_name", type="text", nullable=true)
5b7da076
TC
247 *
248 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
249 */
250 private $domainName;
251
fad31615
JB
252 /**
253 * @var string
254 *
255 * @ORM\Column(name="preview_picture", type="text", nullable=true)
5b7da076
TC
256 *
257 * @Groups({"entries_for_user", "export_all"})
fad31615
JB
258 */
259 private $previewPicture;
260
10b35097 261 /**
e10e6ab3 262 * @var string
10b35097 263 *
3ef75cc4 264 * @ORM\Column(name="http_status", type="string", length=3, nullable=true)
10b35097
NL
265 *
266 * @Groups({"entries_for_user", "export_all"})
267 */
268 private $httpStatus;
269
dda6a6ad
NL
270 /**
271 * @var array
272 *
1517d577 273 * @ORM\Column(name="headers", type="array", nullable=true)
dda6a6ad
NL
274 *
275 * @Groups({"entries_for_user", "export_all"})
276 */
277 private $headers;
278
5f09650e 279 /**
7d1fdab2
TC
280 * @Exclude
281 *
1210dae1 282 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
5b7da076
TC
283 *
284 * @Groups({"export_all"})
5f09650e
NL
285 */
286 private $user;
287
0a018fe0 288 /**
af95c09c 289 * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
e42b13bc
JB
290 * @ORM\JoinTable(
291 * name="entry_tag",
292 * joinColumns={
206bade5 293 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
e42b13bc
JB
294 * },
295 * inverseJoinColumns={
206bade5 296 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="cascade")
e42b13bc
JB
297 * }
298 * )
0a018fe0
NL
299 */
300 private $tags;
301
5f09650e
NL
302 /*
303 * @param User $user
304 */
5d6f6f56 305 public function __construct(User $user)
5f09650e
NL
306 {
307 $this->user = $user;
0a018fe0 308 $this->tags = new ArrayCollection();
5f09650e
NL
309 }
310
9d50517c 311 /**
4346a860 312 * Get id.
9d50517c 313 *
4346a860 314 * @return int
9d50517c
NL
315 */
316 public function getId()
317 {
318 return $this->id;
319 }
320
321 /**
4346a860
JB
322 * Set title.
323 *
324 * @param string $title
9d50517c 325 *
be463487 326 * @return Entry
9d50517c
NL
327 */
328 public function setTitle($title)
329 {
330 $this->title = $title;
331
332 return $this;
333 }
334
335 /**
4346a860 336 * Get title.
9d50517c 337 *
7df80cb3 338 * @return string
9d50517c
NL
339 */
340 public function getTitle()
341 {
342 return $this->title;
343 }
344
345 /**
4346a860
JB
346 * Set url.
347 *
348 * @param string $url
9d50517c 349 *
be463487 350 * @return Entry
9d50517c
NL
351 */
352 public function setUrl($url)
353 {
354 $this->url = $url;
4a551637 355 $this->hashedUrl = UrlHasher::hashUrl($url);
9d50517c
NL
356
357 return $this;
358 }
359
360 /**
4346a860 361 * Get url.
9d50517c 362 *
7df80cb3 363 * @return string
9d50517c
NL
364 */
365 public function getUrl()
366 {
367 return $this->url;
368 }
369
370 /**
4346a860
JB
371 * Set isArchived.
372 *
8eedc8cf 373 * @param bool $isArchived
9d50517c 374 *
be463487 375 * @return Entry
9d50517c 376 */
905ae369 377 public function setArchived($isArchived)
9d50517c 378 {
905ae369 379 $this->isArchived = $isArchived;
9d50517c
NL
380
381 return $this;
382 }
383
7975395d
SV
384 /**
385 * update isArchived and archive_at fields.
386 *
387 * @param bool $isArchived
388 *
389 * @return Entry
390 */
391 public function updateArchived($isArchived = false)
392 {
393 $this->setArchived($isArchived);
394 $this->setArchivedAt(null);
395 if ($this->isArchived()) {
396 $this->setArchivedAt(new \DateTime());
397 }
398
399 return $this;
400 }
401
402 /**
403 * @return \DateTime|null
404 */
405 public function getArchivedAt()
406 {
407 return $this->archivedAt;
408 }
409
410 /**
411 * @param \DateTime|null $archivedAt
412 *
413 * @return Entry
414 */
415 public function setArchivedAt($archivedAt = null)
416 {
417 $this->archivedAt = $archivedAt;
418
419 return $this;
420 }
421
9d50517c 422 /**
4346a860 423 * Get isArchived.
9d50517c 424 *
8eedc8cf 425 * @return bool
9d50517c 426 */
905ae369 427 public function isArchived()
9d50517c 428 {
905ae369 429 return $this->isArchived;
9d50517c
NL
430 }
431
189ef634
TC
432 /**
433 * @VirtualProperty
434 * @SerializedName("is_archived")
435 * @Groups({"entries_for_user", "export_all"})
436 */
437 public function is_Archived()
438 {
439 return (int) $this->isArchived();
440 }
441
163eae0b
NL
442 public function toggleArchive()
443 {
7975395d 444 $this->updateArchived($this->isArchived() ^ 1);
7df80cb3 445
163eae0b
NL
446 return $this;
447 }
448
9d50517c 449 /**
4346a860
JB
450 * Set isStarred.
451 *
8eedc8cf 452 * @param bool $isStarred
9d50517c 453 *
be463487 454 * @return Entry
9d50517c 455 */
905ae369 456 public function setStarred($isStarred)
9d50517c 457 {
905ae369 458 $this->isStarred = $isStarred;
9d50517c
NL
459
460 return $this;
461 }
462
463 /**
4346a860 464 * Get isStarred.
9d50517c 465 *
8eedc8cf 466 * @return bool
9d50517c 467 */
905ae369 468 public function isStarred()
9d50517c 469 {
905ae369 470 return $this->isStarred;
9d50517c
NL
471 }
472
189ef634
TC
473 /**
474 * @VirtualProperty
475 * @SerializedName("is_starred")
476 * @Groups({"entries_for_user", "export_all"})
477 */
478 public function is_Starred()
479 {
480 return (int) $this->isStarred();
481 }
482
163eae0b
NL
483 public function toggleStar()
484 {
905ae369 485 $this->isStarred = $this->isStarred() ^ 1;
163eae0b
NL
486
487 return $this;
488 }
489
9d50517c 490 /**
4346a860
JB
491 * Set content.
492 *
493 * @param string $content
9d50517c 494 *
be463487 495 * @return Entry
9d50517c
NL
496 */
497 public function setContent($content)
498 {
499 $this->content = $content;
500
501 return $this;
502 }
503
504 /**
4346a860 505 * Get content.
9d50517c 506 *
7df80cb3 507 * @return string
9d50517c
NL
508 */
509 public function getContent()
510 {
511 return $this->content;
512 }
513
514 /**
5f09650e 515 * @return User
9d50517c 516 */
5f09650e 517 public function getUser()
9d50517c 518 {
5f09650e 519 return $this->user;
9d50517c 520 }
42a90646 521
7d1fdab2
TC
522 /**
523 * @VirtualProperty
524 * @SerializedName("user_name")
525 */
526 public function getUserName()
527 {
528 return $this->user->getUserName();
529 }
530
531 /**
532 * @VirtualProperty
533 * @SerializedName("user_email")
534 */
535 public function getUserEmail()
536 {
537 return $this->user->getEmail();
538 }
539
540 /**
541 * @VirtualProperty
542 * @SerializedName("user_id")
543 */
544 public function getUserId()
545 {
546 return $this->user->getId();
547 }
548
34d15eb4 549 /**
6d65c0a8
JB
550 * Set created_at.
551 * Only used when importing data from an other service.
552 *
8664069e 553 * @param \DateTime $createdAt
6d65c0a8
JB
554 *
555 * @return Entry
556 */
557 public function setCreatedAt(\DateTime $createdAt)
558 {
559 $this->createdAt = $createdAt;
560
561 return $this;
562 }
563
564 /**
8664069e 565 * @return \DateTime
34d15eb4
NL
566 */
567 public function getCreatedAt()
568 {
569 return $this->createdAt;
570 }
571
34d15eb4 572 /**
8664069e 573 * @return \DateTime
34d15eb4
NL
574 */
575 public function getUpdatedAt()
576 {
577 return $this->updatedAt;
578 }
579
a991c46e
F
580 /**
581 * @return \DateTime|null
582 */
583 public function getStarredAt()
584 {
585 return $this->starredAt;
586 }
587
588 /**
589 * @param \DateTime|null $starredAt
590 *
591 * @return Entry
592 */
593 public function setStarredAt($starredAt = null)
594 {
595 $this->starredAt = $starredAt;
596
597 return $this;
598 }
599
600 /**
601 * update isStarred and starred_at fields.
602 *
603 * @param bool $isStarred
604 *
605 * @return Entry
606 */
607 public function updateStar($isStarred = false)
608 {
609 $this->setStarred($isStarred);
610 $this->setStarredAt(null);
611 if ($this->isStarred()) {
612 $this->setStarredAt(new \DateTime());
613 }
614
615 return $this;
616 }
617
34d15eb4 618 /**
4dc87223 619 * @return ArrayCollection<Annotation>
34d15eb4 620 */
4dc87223 621 public function getAnnotations()
34d15eb4 622 {
4dc87223 623 return $this->annotations;
34d15eb4
NL
624 }
625
626 /**
4dc87223 627 * @param Annotation $annotation
34d15eb4 628 */
4dc87223 629 public function setAnnotation(Annotation $annotation)
34d15eb4 630 {
4dc87223 631 $this->annotations[] = $annotation;
34d15eb4
NL
632 }
633
634 /**
635 * @return string
636 */
637 public function getMimetype()
638 {
639 return $this->mimetype;
640 }
641
642 /**
643 * @param string $mimetype
644 */
645 public function setMimetype($mimetype)
646 {
647 $this->mimetype = $mimetype;
648 }
649
650 /**
651 * @return int
652 */
653 public function getReadingTime()
654 {
655 return $this->readingTime;
656 }
657
658 /**
659 * @param int $readingTime
660 */
661 public function setReadingTime($readingTime)
662 {
663 $this->readingTime = $readingTime;
664 }
665
666 /**
667 * @return string
668 */
669 public function getDomainName()
670 {
671 return $this->domainName;
672 }
673
674 /**
675 * @param string $domainName
676 */
677 public function setDomainName($domainName)
678 {
679 $this->domainName = $domainName;
680 }
681
0a018fe0 682 /**
4ec53ab7 683 * @return ArrayCollection
0a018fe0
NL
684 */
685 public function getTags()
686 {
687 return $this->tags;
688 }
689
b0458874
JB
690 /**
691 * @VirtualProperty
692 * @SerializedName("tags")
693 * @Groups({"entries_for_user", "export_all"})
694 */
695 public function getSerializedTags()
696 {
697 $data = [];
698 foreach ($this->tags as $tag) {
699 $data[] = $tag->getLabel();
700 }
701
702 return $data;
703 }
704
0a018fe0
NL
705 /**
706 * @param Tag $tag
707 */
708 public function addTag(Tag $tag)
709 {
625acf33
KG
710 if ($this->tags->contains($tag)) {
711 return;
712 }
713
fc031e57
JB
714 // check if tag already exist but has not yet be persisted
715 // it seems that the previous condition with `contains()` doesn't check that case
716 foreach ($this->tags as $existingTag) {
fc732227 717 if ($existingTag->getLabel() === $tag->getLabel()) {
fc031e57
JB
718 return;
719 }
720 }
721
e42b13bc 722 $this->tags->add($tag);
46bbd8d3 723 $tag->addEntry($this);
0a018fe0 724 }
092ca707 725
a05b6115
JB
726 /**
727 * Remove the given tag from the entry (if the tag is associated).
728 *
729 * @param Tag $tag
730 */
092ca707
NL
731 public function removeTag(Tag $tag)
732 {
e42b13bc
JB
733 if (!$this->tags->contains($tag)) {
734 return;
735 }
736
092ca707 737 $this->tags->removeElement($tag);
e42b13bc 738 $tag->removeEntry($this);
092ca707 739 }
fad31615 740
a05b6115
JB
741 /**
742 * Remove all assigned tags from the entry.
743 */
744 public function removeAllTags()
745 {
746 foreach ($this->tags as $tag) {
747 $this->tags->removeElement($tag);
748 $tag->removeEntry($this);
749 }
750 }
751
fad31615 752 /**
a1413a3d 753 * Set previewPicture.
fad31615
JB
754 *
755 * @param string $previewPicture
756 *
757 * @return Entry
758 */
759 public function setPreviewPicture($previewPicture)
760 {
761 $this->previewPicture = $previewPicture;
762
763 return $this;
764 }
765
766 /**
a1413a3d 767 * Get previewPicture.
fad31615
JB
768 *
769 * @return string
770 */
771 public function getPreviewPicture()
772 {
773 return $this->previewPicture;
774 }
98f0929f
JB
775
776 /**
777 * Set language.
778 *
779 * @param string $language
780 *
781 * @return Entry
782 */
783 public function setLanguage($language)
784 {
785 $this->language = $language;
786
787 return $this;
788 }
789
790 /**
791 * Get language.
792 *
793 * @return string
794 */
795 public function getLanguage()
796 {
797 return $this->language;
798 }
f3d0cb91
NL
799
800 /**
52e8d932 801 * @return string|null
f3d0cb91 802 */
7239082a 803 public function getUid()
f3d0cb91 804 {
7239082a 805 return $this->uid;
f3d0cb91
NL
806 }
807
808 /**
7239082a 809 * @param string $uid
f3d0cb91
NL
810 *
811 * @return Entry
812 */
7239082a 813 public function setUid($uid)
f3d0cb91 814 {
7239082a 815 $this->uid = $uid;
f3d0cb91
NL
816
817 return $this;
818 }
819
7239082a 820 public function generateUid()
f3d0cb91 821 {
7239082a 822 if (null === $this->uid) {
a7e2218e 823 // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter
7239082a 824 $this->uid = uniqid('', true);
f3d0cb91
NL
825 }
826 }
f1be7af4 827
7239082a 828 public function cleanUid()
f1be7af4 829 {
7239082a 830 $this->uid = null;
f1be7af4 831 }
10b35097 832
e8911f7c
JB
833 /**
834 * Used in the entries filter so it's more explicit for the end user than the uid.
a9c6577f 835 * Also used in the API.
e8911f7c 836 *
1112e547
JB
837 * @VirtualProperty
838 * @SerializedName("is_public")
839 * @Groups({"entries_for_user"})
840 *
e8911f7c
JB
841 * @return bool
842 */
843 public function isPublic()
844 {
845 return null !== $this->uid;
846 }
847
10b35097 848 /**
5fe65bae 849 * @return string
10b35097
NL
850 */
851 public function getHttpStatus()
852 {
853 return $this->httpStatus;
854 }
855
856 /**
5fe65bae 857 * @param string $httpStatus
10b35097
NL
858 *
859 * @return Entry
860 */
861 public function setHttpStatus($httpStatus)
862 {
863 $this->httpStatus = $httpStatus;
864
865 return $this;
866 }
5e9009ce
NL
867
868 /**
869 * @return \Datetime
870 */
871 public function getPublishedAt()
872 {
873 return $this->publishedAt;
874 }
875
876 /**
877 * @param \Datetime $publishedAt
878 *
879 * @return Entry
880 */
881 public function setPublishedAt(\Datetime $publishedAt)
882 {
883 $this->publishedAt = $publishedAt;
884
885 return $this;
886 }
7b0b3622
NL
887
888 /**
dda6a6ad 889 * @return array
7b0b3622
NL
890 */
891 public function getPublishedBy()
892 {
893 return $this->publishedBy;
894 }
895
896 /**
1517d577 897 * @param array $publishedBy
7b0b3622
NL
898 *
899 * @return Entry
900 */
901 public function setPublishedBy($publishedBy)
902 {
903 $this->publishedBy = $publishedBy;
904
905 return $this;
906 }
dda6a6ad
NL
907
908 /**
909 * @return array
910 */
911 public function getHeaders()
912 {
913 return $this->headers;
914 }
915
916 /**
1517d577 917 * @param array $headers
dda6a6ad
NL
918 *
919 * @return Entry
920 */
921 public function setHeaders($headers)
922 {
923 $this->headers = $headers;
924
925 return $this;
926 }
eae8138b 927
e0ef1a1c
KD
928 /**
929 * Set origin url.
930 *
931 * @param string $originUrl
932 *
933 * @return Entry
934 */
935 public function setOriginUrl($originUrl)
936 {
937 $this->originUrl = $originUrl;
938
939 return $this;
940 }
eae8138b 941
e0ef1a1c
KD
942 /**
943 * Get origin url.
944 *
945 * @return string
946 */
947 public function getOriginUrl()
948 {
949 return $this->originUrl;
950 }
bfe02a0b 951
f3bfb875 952 /**
d8809f70 953 * Set given url.
f3bfb875
JB
954 *
955 * @param string $givenUrl
956 *
957 * @return Entry
958 */
959 public function setGivenUrl($givenUrl)
960 {
961 $this->givenUrl = $givenUrl;
962 $this->hashedGivenUrl = UrlHasher::hashUrl($givenUrl);
963
964 return $this;
965 }
966
967 /**
d8809f70 968 * Get given url.
f3bfb875
JB
969 *
970 * @return string
971 */
972 public function getGivenUrl()
973 {
974 return $this->givenUrl;
975 }
976
bfe02a0b
TC
977 /**
978 * @return string
979 */
980 public function getHashedUrl()
981 {
982 return $this->hashedUrl;
983 }
984
985 /**
986 * @param mixed $hashedUrl
987 *
988 * @return Entry
989 */
990 public function setHashedUrl($hashedUrl)
991 {
992 $this->hashedUrl = $hashedUrl;
993
994 return $this;
995 }
9d50517c 996}