]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Config.php
Update deps
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Config.php
index 025d94efb605ee9ff1be2e1f86cadacb536d2d87..fe7942ee261bca550ff3ef2ece24634124c37599 100644 (file)
@@ -2,18 +2,27 @@
 
 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.
  *
  * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
- * @ORM\Table
- * @ORM\Entity
+ * @ORM\Table(
+ *     name="`config`",
+ *     indexes={
+ *         @ORM\Index(name="config_feed_token", columns={"feed_token"}, options={"lengths"={255}}),
+ *     }
+ * )
  */
 class Config
 {
+    const REDIRECT_TO_HOMEPAGE = 0;
+    const REDIRECT_TO_CURRENT_PAGE = 1;
+
     /**
      * @var int
      *
@@ -38,7 +47,7 @@ class Config
      * @Assert\Range(
      *      min = 1,
      *      max = 100000,
-     *      maxMessage = "This will certainly kill the app"
+     *      maxMessage = "validator.item_per_page_too_high"
      * )
      * @ORM\Column(name="items_per_page", type="integer", nullable=false)
      */
@@ -55,33 +64,68 @@ class Config
     /**
      * @var string
      *
-     * @ORM\Column(name="rss_token", type="string", nullable=true)
+     * @ORM\Column(name="feed_token", type="string", nullable=true)
      */
-    private $rssToken;
+    private $feedToken;
 
     /**
      * @var int
      *
-     * @ORM\Column(name="rss_limit", type="integer", nullable=true)
+     * @ORM\Column(name="feed_limit", type="integer", nullable=true)
      * @Assert\Range(
      *      min = 1,
      *      max = 100000,
-     *      maxMessage = "This will certainly kill the app"
+     *      maxMessage = "validator.feed_limit_too_high"
      * )
      */
-    private $rssLimit;
+    private $feedLimit;
 
     /**
-     * @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, options={"default" = 0})
+     */
+    private $actionMarkAsRead;
+
+    /**
+     * @var int
+     *
+     * @ORM\Column(name="list_mode", type="integer", nullable=true)
+     */
+    private $listMode;
+
+    /**
+     * @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();
     }
 
     /**
@@ -169,11 +213,11 @@ class Config
     /**
      * Set user.
      *
-     * @param \Wallabag\CoreBundle\Entity\User $user
+     * @param User $user
      *
      * @return Config
      */
-    public function setUser(\Wallabag\CoreBundle\Entity\User $user = null)
+    public function setUser(User $user = null)
     {
         $this->user = $user;
 
@@ -183,7 +227,7 @@ class Config
     /**
      * Get user.
      *
-     * @return \Wallabag\CoreBundle\Entity\User
+     * @return User
      */
     public function getUser()
     {
@@ -191,50 +235,156 @@ class Config
     }
 
     /**
-     * Set rssToken.
+     * Set feed Token.
      *
-     * @param string $rssToken
+     * @param string $feedToken
      *
      * @return Config
      */
-    public function setRssToken($rssToken)
+    public function setFeedToken($feedToken)
     {
-        $this->rssToken = $rssToken;
+        $this->feedToken = $feedToken;
 
         return $this;
     }
 
     /**
-     * Get rssToken.
+     * Get feedToken.
      *
      * @return string
      */
-    public function getRssToken()
+    public function getFeedToken()
+    {
+        return $this->feedToken;
+    }
+
+    /**
+     * Set Feed Limit.
+     *
+     * @param int $feedLimit
+     *
+     * @return Config
+     */
+    public function setFeedLimit($feedLimit)
     {
-        return $this->rssToken;
+        $this->feedLimit = $feedLimit;
+
+        return $this;
     }
 
     /**
-     * Set rssLimit.
+     * Get Feed Limit.
      *
-     * @param string $rssLimit
+     * @return int
+     */
+    public function getFeedLimit()
+    {
+        return $this->feedLimit;
+    }
+
+    /**
+     * Set readingSpeed.
+     *
+     * @param float $readingSpeed
      *
      * @return Config
      */
-    public function setRssLimit($rssLimit)
+    public function setReadingSpeed($readingSpeed)
     {
-        $this->rssLimit = $rssLimit;
+        $this->readingSpeed = $readingSpeed;
 
         return $this;
     }
 
     /**
-     * Get rssLimit.
+     * 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 getRssLimit()
+    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;
+    }
+
+    /**
+     * @return int
+     */
+    public function getListMode()
+    {
+        return $this->listMode;
+    }
+
+    /**
+     * @param int $listMode
+     *
+     * @return Config
+     */
+    public function setListMode($listMode)
+    {
+        $this->listMode = $listMode;
+
+        return $this;
+    }
+
+    /**
+     * @return Config
+     */
+    public function addTaggingRule(TaggingRule $rule)
+    {
+        $this->taggingRules[] = $rule;
+
+        return $this;
+    }
+
+    /**
+     * @return ArrayCollection<TaggingRule>
+     */
+    public function getTaggingRules()
     {
-        return $this->rssLimit;
+        return $this->taggingRules;
     }
 }