From 5e9009ce86a366001616fad5b28cb59dc20ee4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 5 Apr 2017 22:22:16 +0200 Subject: Added publication date --- src/Wallabag/CoreBundle/Entity/Entry.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7276b437..54f74a14 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -121,6 +121,15 @@ class Entry */ private $updatedAt; + /** + * @var \DateTime + * + * @ORM\Column(name="published_at", type="datetime", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $publishedAt; + /** * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable @@ -701,4 +710,24 @@ class Entry return $this; } + + /** + * @return \Datetime + */ + public function getPublishedAt() + { + return $this->publishedAt; + } + + /** + * @param \Datetime $publishedAt + * + * @return Entry + */ + public function setPublishedAt(\Datetime $publishedAt) + { + $this->publishedAt = $publishedAt; + + return $this; + } } -- cgit v1.2.3 From 7b0b3622ab2dd909028481b294c91f88a5682671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 6 Apr 2017 09:36:20 +0200 Subject: Added author of article --- src/Wallabag/CoreBundle/Entity/Entry.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 54f74a14..8d385eb4 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -130,6 +130,15 @@ class Entry */ private $publishedAt; + /** + * @var array + * + * @ORM\Column(name="published_by", type="json_array", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $publishedBy; + /** * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable @@ -730,4 +739,24 @@ class Entry return $this; } + + /** + * @return string + */ + public function getPublishedBy() + { + return $this->publishedBy; + } + + /** + * @param string $publishedBy + * + * @return Entry + */ + public function setPublishedBy($publishedBy) + { + $this->publishedBy = $publishedBy; + + return $this; + } } -- cgit v1.2.3 From 15e4aea67842ae83f98d9864c5bdafa056381248 Mon Sep 17 00:00:00 2001 From: Maxime Date: Fri, 7 Apr 2017 22:23:20 +0200 Subject: Remove isPublic from Entry entity fix #2598 --- src/Wallabag/CoreBundle/Entity/Entry.php | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7276b437..bbb1fb53 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -174,15 +174,6 @@ class Entry */ private $previewPicture; - /** - * @var bool - * - * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false}) - * - * @Groups({"export_all"}) - */ - private $isPublic; - /** * @var string * @@ -531,22 +522,6 @@ class Entry $this->domainName = $domainName; } - /** - * @return bool - */ - public function isPublic() - { - return $this->isPublic; - } - - /** - * @param bool $isPublic - */ - public function setIsPublic($isPublic) - { - $this->isPublic = $isPublic; - } - /** * @return ArrayCollection */ -- cgit v1.2.3 From dda6a6addc0fd54031514e81d2b55d5066b7157c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 11 May 2017 14:18:21 +0200 Subject: Added headers field in Entry --- src/Wallabag/CoreBundle/Entity/Entry.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index b71c467c..f0983b1c 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -201,6 +201,15 @@ class Entry */ private $httpStatus; + /** + * @var array + * + * @ORM\Column(name="headers", type="json_array", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $headers; + /** * @Exclude * @@ -716,7 +725,7 @@ class Entry } /** - * @return string + * @return array */ public function getPublishedBy() { @@ -734,4 +743,24 @@ class Entry return $this; } + + /** + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * @param string $headers + * + * @return Entry + */ + public function setHeaders($headers) + { + $this->headers = $headers; + + return $this; + } } -- cgit v1.2.3 From 1517d5772db05ce86b9958dc6545471d8702bf60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 11 May 2017 14:53:56 +0200 Subject: Replaced json_array with array And fixed failing test due to @j0k3r :trollface: --- src/Wallabag/CoreBundle/Entity/Entry.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index f0983b1c..08a67c34 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -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"}) */ @@ -204,7 +204,7 @@ class Entry /** * @var array * - * @ORM\Column(name="headers", type="json_array", nullable=true) + * @ORM\Column(name="headers", type="array", nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ @@ -733,7 +733,7 @@ class Entry } /** - * @param string $publishedBy + * @param array $publishedBy * * @return Entry */ @@ -753,7 +753,7 @@ class Entry } /** - * @param string $headers + * @param array $headers * * @return Entry */ -- cgit v1.2.3 From 5fe65baee5910c887ba148b1163a1a53654dc324 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 30 May 2017 11:39:15 +0200 Subject: Fix some Scrutinizer issues --- src/Wallabag/CoreBundle/Entity/Entry.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 08a67c34..29ca9feb 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -550,7 +550,7 @@ class Entry } /** - * @return ArrayCollection + * @return array */ public function getTags() { @@ -685,7 +685,7 @@ class Entry } /** - * @return int + * @return string */ public function getHttpStatus() { @@ -693,7 +693,7 @@ class Entry } /** - * @param int $httpStatus + * @param string $httpStatus * * @return Entry */ -- cgit v1.2.3 From 4ec53ab74c82796a5b3e4bb3ad86ab3f994827cb Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 30 May 2017 13:01:25 +0200 Subject: CS --- src/Wallabag/CoreBundle/Entity/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 29ca9feb..9a7dd4e7 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -550,7 +550,7 @@ class Entry } /** - * @return array + * @return ArrayCollection */ public function getTags() { -- cgit v1.2.3 From e8911f7c09fa9d8009d7c7ee9fb0c181d2ffbc31 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 15:00:52 +0200 Subject: Add isPublic filter on entries --- src/Wallabag/CoreBundle/Entity/Entry.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 9a7dd4e7..365030c7 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -684,6 +684,16 @@ class Entry $this->uid = null; } + /** + * Used in the entries filter so it's more explicit for the end user than the uid. + * + * @return bool + */ + public function isPublic() + { + return null !== $this->uid; + } + /** * @return string */ -- cgit v1.2.3 From 1112e54772c9308ee3d7417869b5b8ef9b2b9812 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 15:31:57 +0200 Subject: Add public filter/field in the API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Listing entries can now be filtered by “public”. Creating or patching an entry can now set is to public or remove the public. Entry response now include “is_public” boolean field --- src/Wallabag/CoreBundle/Entity/Entry.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 365030c7..07d41ed8 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -687,6 +687,10 @@ class Entry /** * Used in the entries filter so it's more explicit for the end user than the uid. * + * @VirtualProperty + * @SerializedName("is_public") + * @Groups({"entries_for_user"}) + * * @return bool */ public function isPublic() -- cgit v1.2.3 From a9c6577f0c51dd4282e022fa4b41cbb7b0e201b3 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 15:37:25 +0200 Subject: Few fixes --- src/Wallabag/CoreBundle/Entity/Entry.php | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 07d41ed8..a0503c39 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -686,6 +686,7 @@ class Entry /** * 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") -- cgit v1.2.3 From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- src/Wallabag/CoreBundle/Entity/Entry.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index a0503c39..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. @@ -478,7 +478,7 @@ class Entry */ public function timestamps() { - if (is_null($this->createdAt)) { + if (null === $this->createdAt) { $this->createdAt = new \DateTime(); } -- cgit v1.2.3 From a05b61159e147776f63baee731b5026796e5f7ae Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 30 Jun 2017 16:54:26 +0200 Subject: Fix PATCH method The PATCH method for the entry should only update what user sent to us and not the whole entry as it was before. Also, sending tags when patching an entry will now remove all current tags & assocatied new ones. --- src/Wallabag/CoreBundle/Entity/Entry.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 581e8906..cba72d31 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -593,6 +593,11 @@ class Entry $tag->addEntry($this); } + /** + * Remove the given tag from the entry (if the tag is associated). + * + * @param Tag $tag + */ public function removeTag(Tag $tag) { if (!$this->tags->contains($tag)) { @@ -603,6 +608,17 @@ class Entry $tag->removeEntry($this); } + /** + * Remove all assigned tags from the entry. + */ + public function removeAllTags() + { + foreach ($this->tags as $tag) { + $this->tags->removeElement($tag); + $tag->removeEntry($this); + } + } + /** * Set previewPicture. * -- cgit v1.2.3 From 927c9e796ff6fad2bf82a965234f52932cdee657 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 6 Jul 2017 09:00:37 +0200 Subject: Add EntityTimestampsTrait to handle dates Refactorize timestamps() method to avoid re-writing it on each entity --- src/Wallabag/CoreBundle/Entity/Entry.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index cba72d31..61d01bdc 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -12,6 +12,7 @@ use JMS\Serializer\Annotation\VirtualProperty; use JMS\Serializer\Annotation\XmlRoot; use Symfony\Component\Validator\Constraints as Assert; use Wallabag\AnnotationBundle\Entity\Annotation; +use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; use Wallabag\UserBundle\Entity\User; /** @@ -32,6 +33,8 @@ use Wallabag\UserBundle\Entity\User; */ class Entry { + use EntityTimestampsTrait; + /** @Serializer\XmlAttribute */ /** * @var int @@ -472,19 +475,6 @@ class Entry return $this->updatedAt; } - /** - * @ORM\PrePersist - * @ORM\PreUpdate - */ - public function timestamps() - { - if (null === $this->createdAt) { - $this->createdAt = new \DateTime(); - } - - $this->updatedAt = new \DateTime(); - } - /** * @return ArrayCollection */ -- cgit v1.2.3 From a991c46eedec0efb24d0a9974b1c7fcabf8cfa66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20D?= Date: Wed, 23 Aug 2017 23:06:40 +0200 Subject: Set a starred_at field when an entry is starred. This date is used to sort starred entries. Can not use Entry::timestamps method otherwise starred_at will be updated each time entry is updated. Add an updateStar method into Entry class A migration script has been added in order to set starred_at field. --- src/Wallabag/CoreBundle/Entity/Entry.php | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 61d01bdc..4367902e 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -142,6 +142,15 @@ class Entry */ private $publishedBy; + /** + * @var \DateTime + * + * @ORM\Column(name="starred_at", type="datetime", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $starredAt = null; + /** * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable @@ -475,6 +484,44 @@ class Entry return $this->updatedAt; } + /** + * @return \DateTime|null + */ + public function getStarredAt() + { + return $this->starredAt; + } + + /** + * @param \DateTime|null $starredAt + * + * @return Entry + */ + public function setStarredAt($starredAt = null) + { + $this->starredAt = $starredAt; + + return $this; + } + + /** + * update isStarred and starred_at fields. + * + * @param bool $isStarred + * + * @return Entry + */ + public function updateStar($isStarred = false) + { + $this->setStarred($isStarred); + $this->setStarredAt(null); + if ($this->isStarred()) { + $this->setStarredAt(new \DateTime()); + } + + return $this; + } + /** * @return ArrayCollection */ -- cgit v1.2.3 From 88bac4a33ef4270049b009b215504bf9bcb0030a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 8 Oct 2017 22:08:18 +0200 Subject: Changed reading_time field to prevent null values --- src/Wallabag/CoreBundle/Entity/Entry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 4367902e..cfb8db75 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -180,11 +180,11 @@ class Entry /** * @var int * - * @ORM\Column(name="reading_time", type="integer", nullable=true) + * @ORM\Column(name="reading_time", type="integer", nullable=false) * * @Groups({"entries_for_user", "export_all"}) */ - private $readingTime; + private $readingTime = 0; /** * @var string -- cgit v1.2.3