]>
Commit | Line | Data |
---|---|---|
c675bd11 KD |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Entity; | |
4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | |
6 | use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert; | |
7 | use Symfony\Component\Validator\Constraints as Assert; | |
8 | ||
9 | /** | |
10 | * Ignore Origin rule. | |
11 | * | |
12 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\IgnoreOriginUserRuleRepository") | |
13 | * @ORM\Table(name="`ignore_origin_user_rule`") | |
14 | * @ORM\Entity | |
15 | */ | |
16 | class IgnoreOriginUserRule 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 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", inversedBy="ignoreOriginRules") | |
42 | */ | |
43 | private $config; | |
44 | ||
45 | /** | |
46 | * Get id. | |
47 | * | |
48 | * @return int | |
49 | */ | |
50 | public function getId() | |
51 | { | |
52 | return $this->id; | |
53 | } | |
54 | ||
55 | /** | |
56 | * Set rule. | |
57 | * | |
58 | * @return IgnoreOriginRuleInterface | |
59 | */ | |
60 | public function setRule(string $rule) | |
61 | { | |
62 | $this->rule = $rule; | |
63 | ||
64 | return $this; | |
65 | } | |
66 | ||
67 | /** | |
68 | * Get rule. | |
69 | * | |
70 | * @return string | |
71 | */ | |
72 | public function getRule() | |
73 | { | |
74 | return $this->rule; | |
75 | } | |
76 | ||
77 | /** | |
78 | * Set config. | |
79 | * | |
80 | * @return IgnoreOriginUserRule | |
81 | */ | |
82 | public function setConfig(Config $config) | |
83 | { | |
84 | $this->config = $config; | |
85 | ||
86 | return $this; | |
87 | } | |
88 | ||
89 | /** | |
90 | * Get config. | |
91 | * | |
92 | * @return Config | |
93 | */ | |
94 | public function getConfig() | |
95 | { | |
96 | return $this->config; | |
97 | } | |
98 | } |