]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Config.php
Merge pull request #1786 from wallabag/v2-restrict-user-infos
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Config.php
index ddd4f7d98792aa2e2581de544292b981cdea9c41..d3590f35f0945495ef6f07697ebb83a96afe44e1 100644 (file)
@@ -2,14 +2,16 @@
 
 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\Table(name="`config`")
  * @ORM\Entity
  */
 class Config
@@ -76,12 +78,19 @@ class 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(Wallabag\UserBundle\Entity\User $user)
+    public function __construct(User $user)
     {
         $this->user = $user;
+        $this->taggingRules = new ArrayCollection();
     }
 
     /**
@@ -217,7 +226,7 @@ class Config
     /**
      * Set rssLimit.
      *
-     * @param string $rssLimit
+     * @param int $rssLimit
      *
      * @return Config
      */
@@ -231,10 +240,30 @@ class Config
     /**
      * Get rssLimit.
      *
-     * @return string
+     * @return int
      */
     public function getRssLimit()
     {
         return $this->rssLimit;
     }
+
+    /**
+     * @param TaggingRule $rule
+     *
+     * @return Config
+     */
+    public function addTaggingRule(TaggingRule $rule)
+    {
+        $this->taggingRules[] = $rule;
+
+        return $this;
+    }
+
+    /**
+     * @return ArrayCollection<TaggingRule>
+     */
+    public function getTaggingRules()
+    {
+        return $this->taggingRules;
+    }
 }