X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=581e890666ba9e5c6ea21a25646d1e759435e5c7;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=b71c467cf6ba3942812e670510cccbe00fd14b6f;hpb=54c2d164a362e64a320438b439bf9dd6d2c02424;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index b71c467c..581e8906 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -5,14 +5,14 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Hateoas\Configuration\Annotation as Hateoas; -use JMS\Serializer\Annotation\Groups; -use JMS\Serializer\Annotation\XmlRoot; use JMS\Serializer\Annotation\Exclude; -use JMS\Serializer\Annotation\VirtualProperty; +use JMS\Serializer\Annotation\Groups; use JMS\Serializer\Annotation\SerializedName; +use JMS\Serializer\Annotation\VirtualProperty; +use JMS\Serializer\Annotation\XmlRoot; use Symfony\Component\Validator\Constraints as Assert; -use Wallabag\UserBundle\Entity\User; use Wallabag\AnnotationBundle\Entity\Annotation; +use Wallabag\UserBundle\Entity\User; /** * Entry. @@ -133,7 +133,7 @@ class Entry /** * @var array * - * @ORM\Column(name="published_by", type="json_array", nullable=true) + * @ORM\Column(name="published_by", type="array", nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ @@ -201,6 +201,15 @@ class Entry */ private $httpStatus; + /** + * @var array + * + * @ORM\Column(name="headers", type="array", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $headers; + /** * @Exclude * @@ -469,7 +478,7 @@ class Entry */ public function timestamps() { - if (is_null($this->createdAt)) { + if (null === $this->createdAt) { $this->createdAt = new \DateTime(); } @@ -541,7 +550,7 @@ class Entry } /** - * @return ArrayCollection + * @return ArrayCollection */ public function getTags() { @@ -676,7 +685,22 @@ class Entry } /** - * @return int + * Used in the entries filter so it's more explicit for the end user than the uid. + * Also used in the API. + * + * @VirtualProperty + * @SerializedName("is_public") + * @Groups({"entries_for_user"}) + * + * @return bool + */ + public function isPublic() + { + return null !== $this->uid; + } + + /** + * @return string */ public function getHttpStatus() { @@ -684,7 +708,7 @@ class Entry } /** - * @param int $httpStatus + * @param string $httpStatus * * @return Entry */ @@ -716,7 +740,7 @@ class Entry } /** - * @return string + * @return array */ public function getPublishedBy() { @@ -724,7 +748,7 @@ class Entry } /** - * @param string $publishedBy + * @param array $publishedBy * * @return Entry */ @@ -734,4 +758,24 @@ class Entry return $this; } + + /** + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * @param array $headers + * + * @return Entry + */ + public function setHeaders($headers) + { + $this->headers = $headers; + + return $this; + } }