aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2019-06-23 22:13:06 +0200
committerKevin Decherf <kevin@kdecherf.com>2020-04-25 15:59:23 +0200
commitc675bd11c66e60a1976dfd66484448dcc9d80f0f (patch)
tree609a1b8d355365ccf83b70bf5df6b140bb86e196 /src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php
parent8a8a78a64c116caf81aaa4339906298bdc0e32e0 (diff)
downloadwallabag-c675bd11c66e60a1976dfd66484448dcc9d80f0f.tar.gz
wallabag-c675bd11c66e60a1976dfd66484448dcc9d80f0f.tar.zst
wallabag-c675bd11c66e60a1976dfd66484448dcc9d80f0f.zip
Add IgnoreOriginRule-related entities, db migration, update config
Add IgnoreOriginUserRule for user-defined rules and IgnoreOriginInstanceRule for system-wide rules. Add an interface for these two new entities. Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php b/src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php
new file mode 100644
index 00000000..34aed50c
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/IgnoreOriginInstanceRule.php
@@ -0,0 +1,71 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;
7use Symfony\Component\Validator\Constraints as Assert;
8
9/**
10 * Ignore Origin rule.
11 *
12 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository")
13 * @ORM\Table(name="`ignore_origin_instance_rule`")
14 * @ORM\Entity
15 */
16class IgnoreOriginInstanceRule implements IgnoreOriginRuleInterface, RuleInterface
17{
18 /**
19 * @var int
20 *
21 * @ORM\Column(name="id", type="integer")
22 * @ORM\Id
23 * @ORM\GeneratedValue(strategy="AUTO")
24 */
25 private $id;
26
27 /**
28 * @var string
29 *
30 * @Assert\NotBlank()
31 * @Assert\Length(max=255)
32 * @RulerZAssert\ValidRule(
33 * allowed_variables={"host","pattern"},
34 * allowed_operators={"=","~"}
35 * )
36 * @ORM\Column(name="rule", type="string", nullable=false)
37 */
38 private $rule;
39
40 /**
41 * Get id.
42 *
43 * @return int
44 */
45 public function getId()
46 {
47 return $this->id;
48 }
49
50 /**
51 * Set rule.
52 *
53 * @return IgnoreOriginRuleInterface
54 */
55 public function setRule(string $rule)
56 {
57 $this->rule = $rule;
58
59 return $this;
60 }
61
62 /**
63 * Get rule.
64 *
65 * @return string
66 */
67 public function getRule()
68 {
69 return $this->rule;
70 }
71}