diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 129 |
1 files changed, 103 insertions, 26 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7276b437..a0503c39 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -122,6 +122,24 @@ class Entry | |||
122 | private $updatedAt; | 122 | private $updatedAt; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @var \DateTime | ||
126 | * | ||
127 | * @ORM\Column(name="published_at", type="datetime", nullable=true) | ||
128 | * | ||
129 | * @Groups({"entries_for_user", "export_all"}) | ||
130 | */ | ||
131 | private $publishedAt; | ||
132 | |||
133 | /** | ||
134 | * @var array | ||
135 | * | ||
136 | * @ORM\Column(name="published_by", type="array", nullable=true) | ||
137 | * | ||
138 | * @Groups({"entries_for_user", "export_all"}) | ||
139 | */ | ||
140 | private $publishedBy; | ||
141 | |||
142 | /** | ||
125 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) | 143 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) |
126 | * @ORM\JoinTable | 144 | * @ORM\JoinTable |
127 | * | 145 | * |
@@ -175,22 +193,22 @@ class Entry | |||
175 | private $previewPicture; | 193 | private $previewPicture; |
176 | 194 | ||
177 | /** | 195 | /** |
178 | * @var bool | 196 | * @var string |
179 | * | 197 | * |
180 | * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false}) | 198 | * @ORM\Column(name="http_status", type="string", length=3, nullable=true) |
181 | * | 199 | * |
182 | * @Groups({"export_all"}) | 200 | * @Groups({"entries_for_user", "export_all"}) |
183 | */ | 201 | */ |
184 | private $isPublic; | 202 | private $httpStatus; |
185 | 203 | ||
186 | /** | 204 | /** |
187 | * @var string | 205 | * @var array |
188 | * | 206 | * |
189 | * @ORM\Column(name="http_status", type="string", length=3, nullable=true) | 207 | * @ORM\Column(name="headers", type="array", nullable=true) |
190 | * | 208 | * |
191 | * @Groups({"entries_for_user", "export_all"}) | 209 | * @Groups({"entries_for_user", "export_all"}) |
192 | */ | 210 | */ |
193 | private $httpStatus; | 211 | private $headers; |
194 | 212 | ||
195 | /** | 213 | /** |
196 | * @Exclude | 214 | * @Exclude |
@@ -532,23 +550,7 @@ class Entry | |||
532 | } | 550 | } |
533 | 551 | ||
534 | /** | 552 | /** |
535 | * @return bool | 553 | * @return ArrayCollection |
536 | */ | ||
537 | public function isPublic() | ||
538 | { | ||
539 | return $this->isPublic; | ||
540 | } | ||
541 | |||
542 | /** | ||
543 | * @param bool $isPublic | ||
544 | */ | ||
545 | public function setIsPublic($isPublic) | ||
546 | { | ||
547 | $this->isPublic = $isPublic; | ||
548 | } | ||
549 | |||
550 | /** | ||
551 | * @return ArrayCollection<Tag> | ||
552 | */ | 554 | */ |
553 | public function getTags() | 555 | public function getTags() |
554 | { | 556 | { |
@@ -683,7 +685,22 @@ class Entry | |||
683 | } | 685 | } |
684 | 686 | ||
685 | /** | 687 | /** |
686 | * @return int | 688 | * Used in the entries filter so it's more explicit for the end user than the uid. |
689 | * Also used in the API. | ||
690 | * | ||
691 | * @VirtualProperty | ||
692 | * @SerializedName("is_public") | ||
693 | * @Groups({"entries_for_user"}) | ||
694 | * | ||
695 | * @return bool | ||
696 | */ | ||
697 | public function isPublic() | ||
698 | { | ||
699 | return null !== $this->uid; | ||
700 | } | ||
701 | |||
702 | /** | ||
703 | * @return string | ||
687 | */ | 704 | */ |
688 | public function getHttpStatus() | 705 | public function getHttpStatus() |
689 | { | 706 | { |
@@ -691,7 +708,7 @@ class Entry | |||
691 | } | 708 | } |
692 | 709 | ||
693 | /** | 710 | /** |
694 | * @param int $httpStatus | 711 | * @param string $httpStatus |
695 | * | 712 | * |
696 | * @return Entry | 713 | * @return Entry |
697 | */ | 714 | */ |
@@ -701,4 +718,64 @@ class Entry | |||
701 | 718 | ||
702 | return $this; | 719 | return $this; |
703 | } | 720 | } |
721 | |||
722 | /** | ||
723 | * @return \Datetime | ||
724 | */ | ||
725 | public function getPublishedAt() | ||
726 | { | ||
727 | return $this->publishedAt; | ||
728 | } | ||
729 | |||
730 | /** | ||
731 | * @param \Datetime $publishedAt | ||
732 | * | ||
733 | * @return Entry | ||
734 | */ | ||
735 | public function setPublishedAt(\Datetime $publishedAt) | ||
736 | { | ||
737 | $this->publishedAt = $publishedAt; | ||
738 | |||
739 | return $this; | ||
740 | } | ||
741 | |||
742 | /** | ||
743 | * @return array | ||
744 | */ | ||
745 | public function getPublishedBy() | ||
746 | { | ||
747 | return $this->publishedBy; | ||
748 | } | ||
749 | |||
750 | /** | ||
751 | * @param array $publishedBy | ||
752 | * | ||
753 | * @return Entry | ||
754 | */ | ||
755 | public function setPublishedBy($publishedBy) | ||
756 | { | ||
757 | $this->publishedBy = $publishedBy; | ||
758 | |||
759 | return $this; | ||
760 | } | ||
761 | |||
762 | /** | ||
763 | * @return array | ||
764 | */ | ||
765 | public function getHeaders() | ||
766 | { | ||
767 | return $this->headers; | ||
768 | } | ||
769 | |||
770 | /** | ||
771 | * @param array $headers | ||
772 | * | ||
773 | * @return Entry | ||
774 | */ | ||
775 | public function setHeaders($headers) | ||
776 | { | ||
777 | $this->headers = $headers; | ||
778 | |||
779 | return $this; | ||
780 | } | ||
704 | } | 781 | } |