]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Config.php
Fix \&
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Config.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Entity;
4
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\ORM\Mapping as ORM;
7 use Symfony\Component\Validator\Constraints as Assert;
8 use Wallabag\UserBundle\Entity\User;
9
10 /**
11 * Config.
12 *
13 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
14 * @ORM\Table(name="`config`")
15 * @ORM\Entity
16 */
17 class Config
18 {
19 /**
20 * @var int
21 *
22 * @ORM\Column(name="id", type="integer")
23 * @ORM\Id
24 * @ORM\GeneratedValue(strategy="AUTO")
25 */
26 private $id;
27
28 /**
29 * @var string
30 *
31 * @Assert\NotBlank()
32 * @ORM\Column(name="theme", type="string", nullable=false)
33 */
34 private $theme;
35
36 /**
37 * @var int
38 *
39 * @Assert\NotBlank()
40 * @Assert\Range(
41 * min = 1,
42 * max = 100000,
43 * maxMessage = "This will certainly kill the app"
44 * )
45 * @ORM\Column(name="items_per_page", type="integer", nullable=false)
46 */
47 private $itemsPerPage;
48
49 /**
50 * @var string
51 *
52 * @Assert\NotBlank()
53 * @ORM\Column(name="language", type="string", nullable=false)
54 */
55 private $language;
56
57 /**
58 * @var string
59 *
60 * @ORM\Column(name="rss_token", type="string", nullable=true)
61 */
62 private $rssToken;
63
64 /**
65 * @var int
66 *
67 * @ORM\Column(name="rss_limit", type="integer", nullable=true)
68 * @Assert\Range(
69 * min = 1,
70 * max = 100000,
71 * maxMessage = "This will certainly kill the app"
72 * )
73 */
74 private $rssLimit;
75
76 /**
77 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
78 */
79 private $user;
80
81 /**
82 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
83 * @ORM\OrderBy({"id" = "ASC"})
84 */
85 private $taggingRules;
86
87 /*
88 * @param User $user
89 */
90 public function __construct(User $user)
91 {
92 $this->user = $user;
93 $this->taggingRules = new ArrayCollection();
94 }
95
96 /**
97 * Get id.
98 *
99 * @return int
100 */
101 public function getId()
102 {
103 return $this->id;
104 }
105
106 /**
107 * Set theme.
108 *
109 * @param string $theme
110 *
111 * @return Config
112 */
113 public function setTheme($theme)
114 {
115 $this->theme = $theme;
116
117 return $this;
118 }
119
120 /**
121 * Get theme.
122 *
123 * @return string
124 */
125 public function getTheme()
126 {
127 return $this->theme;
128 }
129
130 /**
131 * Set itemsPerPage.
132 *
133 * @param int $itemsPerPage
134 *
135 * @return Config
136 */
137 public function setItemsPerPage($itemsPerPage)
138 {
139 $this->itemsPerPage = $itemsPerPage;
140
141 return $this;
142 }
143
144 /**
145 * Get itemsPerPage.
146 *
147 * @return int
148 */
149 public function getItemsPerPage()
150 {
151 return $this->itemsPerPage;
152 }
153
154 /**
155 * Set language.
156 *
157 * @param string $language
158 *
159 * @return Config
160 */
161 public function setLanguage($language)
162 {
163 $this->language = $language;
164
165 return $this;
166 }
167
168 /**
169 * Get language.
170 *
171 * @return string
172 */
173 public function getLanguage()
174 {
175 return $this->language;
176 }
177
178 /**
179 * Set user.
180 *
181 * @param User $user
182 *
183 * @return Config
184 */
185 public function setUser(User $user = null)
186 {
187 $this->user = $user;
188
189 return $this;
190 }
191
192 /**
193 * Get user.
194 *
195 * @return User
196 */
197 public function getUser()
198 {
199 return $this->user;
200 }
201
202 /**
203 * Set rssToken.
204 *
205 * @param string $rssToken
206 *
207 * @return Config
208 */
209 public function setRssToken($rssToken)
210 {
211 $this->rssToken = $rssToken;
212
213 return $this;
214 }
215
216 /**
217 * Get rssToken.
218 *
219 * @return string
220 */
221 public function getRssToken()
222 {
223 return $this->rssToken;
224 }
225
226 /**
227 * Set rssLimit.
228 *
229 * @param int $rssLimit
230 *
231 * @return Config
232 */
233 public function setRssLimit($rssLimit)
234 {
235 $this->rssLimit = $rssLimit;
236
237 return $this;
238 }
239
240 /**
241 * Get rssLimit.
242 *
243 * @return int
244 */
245 public function getRssLimit()
246 {
247 return $this->rssLimit;
248 }
249
250 /**
251 * @param TaggingRule $rule
252 *
253 * @return Config
254 */
255 public function addTaggingRule(TaggingRule $rule)
256 {
257 $this->taggingRules[] = $rule;
258
259 return $this;
260 }
261
262 /**
263 * @return ArrayCollection<TaggingRule>
264 */
265 public function getTaggingRules()
266 {
267 return $this->taggingRules;
268 }
269 }