]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
CS
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index f139bbacc0ce80500249e2d7dd956cd7de93beec..e684c9b103f77189b6d799549c2fabd33561fe9e 100644 (file)
@@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;
 use Hateoas\Configuration\Annotation as Hateoas;
 use JMS\Serializer\Annotation\XmlRoot;
+use Wallabag\CoreBundle\Tools\Utils;
 
 /**
  * Entry.
@@ -96,7 +97,7 @@ class Entry
     /**
      * @var int
      *
-     * @ORM\Column(name="reading_type", type="integer", nullable=true)
+     * @ORM\Column(name="reading_time", type="integer", nullable=true)
      */
     private $readingTime;
 
@@ -107,6 +108,13 @@ class Entry
      */
     private $domainName;
 
+    /**
+     * @var string
+     *
+     * @ORM\Column(name="preview_picture", type="text", nullable=true)
+     */
+    private $previewPicture;
+
     /**
      * @var bool
      *
@@ -264,6 +272,8 @@ class Entry
     public function setContent($content)
     {
         $this->content = $content;
+        $this->readingTime = Utils::getReadingTime($content);
+        $this->domainName = parse_url($this->url, PHP_URL_HOST);
 
         return $this;
     }
@@ -416,4 +426,28 @@ class Entry
     {
         $this->tags->removeElement($tag);
     }
+
+    /**
+     * Set previewPicture.
+     *
+     * @param string $previewPicture
+     *
+     * @return Entry
+     */
+    public function setPreviewPicture($previewPicture)
+    {
+        $this->previewPicture = $previewPicture;
+
+        return $this;
+    }
+
+    /**
+     * Get previewPicture.
+     *
+     * @return string
+     */
+    public function getPreviewPicture()
+    {
+        return $this->previewPicture;
+    }
 }