]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Config.php
Added a configuration to define the redirection after archiving an entry
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Config.php
index 56eff30c5f48a202a467c41300c9c375bfb6874f..c40d1535f1a62cb013e08e7ece264ed657a3a08f 100644 (file)
@@ -2,20 +2,22 @@
 
 namespace Wallabag\CoreBundle\Entity;
 
+use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;
+use Wallabag\UserBundle\Entity\User;
 
 /**
- * Config
+ * Config.
  *
  * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
- * @ORM\Table(name="config")
+ * @ORM\Table(name="`config`")
  * @ORM\Entity
  */
 class Config
 {
     /**
-     * @var integer
+     * @var int
      *
      * @ORM\Column(name="id", type="integer")
      * @ORM\Id
@@ -32,9 +34,14 @@ class Config
     private $theme;
 
     /**
-     * @var integer
+     * @var int
      *
      * @Assert\NotBlank()
+     * @Assert\Range(
+     *      min = 1,
+     *      max = 100000,
+     *      maxMessage = "validator.item_per_page_too_high"
+     * )
      * @ORM\Column(name="items_per_page", type="integer", nullable=false)
      */
     private $itemsPerPage;
@@ -55,29 +62,62 @@ class Config
     private $rssToken;
 
     /**
-     * @var integer
+     * @var int
      *
      * @ORM\Column(name="rss_limit", type="integer", nullable=true)
+     * @Assert\Range(
+     *      min = 1,
+     *      max = 100000,
+     *      maxMessage = "validator.rss_limit_too_hight"
+     * )
      */
     private $rssLimit;
 
     /**
-     * @ORM\OneToOne(targetEntity="User", inversedBy="config")
+     * @var float
+     *
+     * @ORM\Column(name="reading_speed", type="float", nullable=true)
+     */
+    private $readingSpeed;
+
+    /**
+     * @var string
+     *
+     * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
+     */
+    private $pocketConsumerKey;
+
+    /**
+     * @var int
+     *
+     * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true)
+     */
+    private $actionMarkAsRead;
+
+    /**
+     * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
      */
     private $user;
 
+    /**
+     * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
+     * @ORM\OrderBy({"id" = "ASC"})
+     */
+    private $taggingRules;
+
     /*
      * @param User     $user
      */
     public function __construct(User $user)
     {
         $this->user = $user;
+        $this->taggingRules = new ArrayCollection();
     }
 
     /**
-     * Get id
+     * Get id.
      *
-     * @return integer
+     * @return int
      */
     public function getId()
     {
@@ -85,9 +125,10 @@ class Config
     }
 
     /**
-     * Set theme
+     * Set theme.
+     *
+     * @param string $theme
      *
-     * @param  string $theme
      * @return Config
      */
     public function setTheme($theme)
@@ -98,7 +139,7 @@ class Config
     }
 
     /**
-     * Get theme
+     * Get theme.
      *
      * @return string
      */
@@ -108,9 +149,10 @@ class Config
     }
 
     /**
-     * Set itemsPerPage
+     * Set itemsPerPage.
+     *
+     * @param int $itemsPerPage
      *
-     * @param  integer $itemsPerPage
      * @return Config
      */
     public function setItemsPerPage($itemsPerPage)
@@ -121,9 +163,9 @@ class Config
     }
 
     /**
-     * Get itemsPerPage
+     * Get itemsPerPage.
      *
-     * @return integer
+     * @return int
      */
     public function getItemsPerPage()
     {
@@ -131,9 +173,10 @@ class Config
     }
 
     /**
-     * Set language
+     * Set language.
+     *
+     * @param string $language
      *
-     * @param  string $language
      * @return Config
      */
     public function setLanguage($language)
@@ -144,7 +187,7 @@ class Config
     }
 
     /**
-     * Get language
+     * Get language.
      *
      * @return string
      */
@@ -154,12 +197,13 @@ class Config
     }
 
     /**
-     * Set user
+     * Set user.
+     *
+     * @param User $user
      *
-     * @param  \Wallabag\CoreBundle\Entity\User $user
      * @return Config
      */
-    public function setUser(\Wallabag\CoreBundle\Entity\User $user = null)
+    public function setUser(User $user = null)
     {
         $this->user = $user;
 
@@ -167,9 +211,9 @@ class Config
     }
 
     /**
-     * Get user
+     * Get user.
      *
-     * @return \Wallabag\CoreBundle\Entity\User
+     * @return User
      */
     public function getUser()
     {
@@ -177,9 +221,10 @@ class Config
     }
 
     /**
-     * Set rssToken
+     * Set rssToken.
+     *
+     * @param string $rssToken
      *
-     * @param  string $rssToken
      * @return Config
      */
     public function setRssToken($rssToken)
@@ -190,7 +235,7 @@ class Config
     }
 
     /**
-     * Get rssToken
+     * Get rssToken.
      *
      * @return string
      */
@@ -200,9 +245,10 @@ class Config
     }
 
     /**
-     * Set rssLimit
+     * Set rssLimit.
+     *
+     * @param int $rssLimit
      *
-     * @param  string $rssLimit
      * @return Config
      */
     public function setRssLimit($rssLimit)
@@ -213,12 +259,100 @@ class Config
     }
 
     /**
-     * Get rssLimit
+     * Get rssLimit.
      *
-     * @return string
+     * @return int
      */
     public function getRssLimit()
     {
         return $this->rssLimit;
     }
+
+    /**
+     * Set readingSpeed.
+     *
+     * @param float $readingSpeed
+     *
+     * @return Config
+     */
+    public function setReadingSpeed($readingSpeed)
+    {
+        $this->readingSpeed = $readingSpeed;
+
+        return $this;
+    }
+
+    /**
+     * Get readingSpeed.
+     *
+     * @return float
+     */
+    public function getReadingSpeed()
+    {
+        return $this->readingSpeed;
+    }
+
+    /**
+     * Set pocketConsumerKey.
+     *
+     * @param string $pocketConsumerKey
+     *
+     * @return Config
+     */
+    public function setPocketConsumerKey($pocketConsumerKey)
+    {
+        $this->pocketConsumerKey = $pocketConsumerKey;
+
+        return $this;
+    }
+
+    /**
+     * Get pocketConsumerKey.
+     *
+     * @return string
+     */
+    public function getPocketConsumerKey()
+    {
+        return $this->pocketConsumerKey;
+    }
+
+    /**
+     * @return int
+     */
+    public function getActionMarkAsRead()
+    {
+        return $this->actionMarkAsRead;
+    }
+
+    /**
+     * @param int $actionMarkAsRead
+     *
+     * @return Config
+     */
+    public function setActionMarkAsRead($actionMarkAsRead)
+    {
+        $this->actionMarkAsRead = $actionMarkAsRead;
+
+        return $this;
+    }
+
+    /**
+     * @param TaggingRule $rule
+     *
+     * @return Config
+     */
+    public function addTaggingRule(TaggingRule $rule)
+    {
+        $this->taggingRules[] = $rule;
+
+        return $this;
+    }
+
+    /**
+     * @return ArrayCollection<TaggingRule>
+     */
+    public function getTaggingRules()
+    {
+        return $this->taggingRules;
+    }
 }