]>
Commit | Line | Data |
---|---|---|
ac9fec61 KG |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Entity; | |
4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | |
6 | use Symfony\Component\Validator\Constraints as Assert; | |
3447d1ee | 7 | use KPhoen\RulerZBundle\Validator\Constraints as RulerZAssert; |
ac9fec61 KG |
8 | |
9 | /** | |
7b164896 | 10 | * Tagging rule. |
ac9fec61 KG |
11 | * |
12 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TaggingRuleRepository") | |
c5d0db8b | 13 | * @ORM\Table(name="`tagging_rule`") |
ac9fec61 KG |
14 | * @ORM\Entity |
15 | */ | |
16 | class TaggingRule | |
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() | |
c23fc05d KG |
31 | * @RulerZAssert\ValidRule( |
32 | * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, | |
a6e27f74 | 33 | * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"} |
c23fc05d | 34 | * ) |
ac9fec61 KG |
35 | * @ORM\Column(name="rule", type="string", nullable=false) |
36 | */ | |
37 | private $rule; | |
38 | ||
39 | /** | |
40 | * @var array | |
41 | * | |
42 | * @Assert\NotBlank() | |
43 | * @ORM\Column(name="tags", type="simple_array", nullable=false) | |
44 | */ | |
45 | private $tags = []; | |
46 | ||
47 | /** | |
48 | * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", inversedBy="taggingRules") | |
49 | */ | |
50 | private $config; | |
51 | ||
52 | /** | |
53 | * Get id. | |
54 | * | |
55 | * @return int | |
56 | */ | |
57 | public function getId() | |
58 | { | |
59 | return $this->id; | |
60 | } | |
61 | ||
62 | /** | |
63 | * Set rule. | |
64 | * | |
65 | * @param string $rule | |
66 | * | |
67 | * @return TaggingRule | |
68 | */ | |
69 | public function setRule($rule) | |
70 | { | |
71 | $this->rule = $rule; | |
72 | ||
73 | return $this; | |
74 | } | |
75 | ||
76 | /** | |
77 | * Get rule. | |
78 | * | |
79 | * @return string | |
80 | */ | |
81 | public function getRule() | |
82 | { | |
83 | return $this->rule; | |
84 | } | |
85 | ||
86 | /** | |
87 | * Set tags. | |
88 | * | |
89 | * @param array<string> $tags | |
90 | * | |
91 | * @return TaggingRule | |
92 | */ | |
93 | public function setTags(array $tags) | |
94 | { | |
95 | $this->tags = $tags; | |
96 | ||
97 | return $this; | |
98 | } | |
99 | ||
100 | /** | |
101 | * Get tags. | |
102 | * | |
103 | * @return array<string> | |
104 | */ | |
105 | public function getTags() | |
106 | { | |
107 | return $this->tags; | |
108 | } | |
109 | ||
110 | /** | |
111 | * Set config. | |
112 | * | |
113 | * @param Config $config | |
114 | * | |
115 | * @return TaggingRule | |
116 | */ | |
117 | public function setConfig(Config $config) | |
118 | { | |
119 | $this->config = $config; | |
120 | ||
121 | return $this; | |
122 | } | |
123 | ||
124 | /** | |
125 | * Get config. | |
126 | * | |
127 | * @return Config | |
128 | */ | |
129 | public function getConfig() | |
130 | { | |
131 | return $this->config; | |
132 | } | |
133 | } |