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