X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FConfig.php;h=2ca4182e6700da790f8f6f02e1fa44701bbee1ed;hb=fc73222723c7a0c9b577805d3ef51eb96b124b92;hp=ddd4f7d98792aa2e2581de544292b981cdea9c41;hpb=1210dae10589515d6f3824c75639342c5e1d52dd;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index ddd4f7d9..2ca4182e 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -2,6 +2,7 @@ namespace Wallabag\CoreBundle\Entity; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; @@ -9,7 +10,7 @@ use Symfony\Component\Validator\Constraints as Assert; * Config. * * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository") - * @ORM\Table + * @ORM\Table(name="`config`") * @ORM\Entity */ class Config @@ -76,12 +77,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(\Wallabag\UserBundle\Entity\User $user) { $this->user = $user; + $this->taggingRules = new ArrayCollection(); } /** @@ -173,7 +181,7 @@ class Config * * @return Config */ - public function setUser(User $user = null) + public function setUser(\Wallabag\UserBundle\Entity\User $user = null) { $this->user = $user; @@ -237,4 +245,24 @@ class Config { return $this->rssLimit; } + + /** + * @param TaggingRule $rule + * + * @return Config + */ + public function addTaggingRule(TaggingRule $rule) + { + $this->taggingRules[] = $rule; + + return $this; + } + + /** + * @return ArrayCollection + */ + public function getTaggingRules() + { + return $this->taggingRules; + } }