]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Config.php
Added a configuration to define the redirection after archiving an entry
[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 = "validator.item_per_page_too_high"
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 = "validator.rss_limit_too_hight"
72 * )
73 */
74 private $rssLimit;
75
76 /**
77 * @var float
78 *
79 * @ORM\Column(name="reading_speed", type="float", nullable=true)
80 */
81 private $readingSpeed;
82
83 /**
84 * @var string
85 *
86 * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
87 */
88 private $pocketConsumerKey;
89
90 /**
91 * @var int
92 *
93 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true)
94 */
95 private $actionMarkAsRead;
96
97 /**
98 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
99 */
100 private $user;
101
102 /**
103 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
104 * @ORM\OrderBy({"id" = "ASC"})
105 */
106 private $taggingRules;
107
108 /*
109 * @param User $user
110 */
111 public function __construct(User $user)
112 {
113 $this->user = $user;
114 $this->taggingRules = new ArrayCollection();
115 }
116
117 /**
118 * Get id.
119 *
120 * @return int
121 */
122 public function getId()
123 {
124 return $this->id;
125 }
126
127 /**
128 * Set theme.
129 *
130 * @param string $theme
131 *
132 * @return Config
133 */
134 public function setTheme($theme)
135 {
136 $this->theme = $theme;
137
138 return $this;
139 }
140
141 /**
142 * Get theme.
143 *
144 * @return string
145 */
146 public function getTheme()
147 {
148 return $this->theme;
149 }
150
151 /**
152 * Set itemsPerPage.
153 *
154 * @param int $itemsPerPage
155 *
156 * @return Config
157 */
158 public function setItemsPerPage($itemsPerPage)
159 {
160 $this->itemsPerPage = $itemsPerPage;
161
162 return $this;
163 }
164
165 /**
166 * Get itemsPerPage.
167 *
168 * @return int
169 */
170 public function getItemsPerPage()
171 {
172 return $this->itemsPerPage;
173 }
174
175 /**
176 * Set language.
177 *
178 * @param string $language
179 *
180 * @return Config
181 */
182 public function setLanguage($language)
183 {
184 $this->language = $language;
185
186 return $this;
187 }
188
189 /**
190 * Get language.
191 *
192 * @return string
193 */
194 public function getLanguage()
195 {
196 return $this->language;
197 }
198
199 /**
200 * Set user.
201 *
202 * @param User $user
203 *
204 * @return Config
205 */
206 public function setUser(User $user = null)
207 {
208 $this->user = $user;
209
210 return $this;
211 }
212
213 /**
214 * Get user.
215 *
216 * @return User
217 */
218 public function getUser()
219 {
220 return $this->user;
221 }
222
223 /**
224 * Set rssToken.
225 *
226 * @param string $rssToken
227 *
228 * @return Config
229 */
230 public function setRssToken($rssToken)
231 {
232 $this->rssToken = $rssToken;
233
234 return $this;
235 }
236
237 /**
238 * Get rssToken.
239 *
240 * @return string
241 */
242 public function getRssToken()
243 {
244 return $this->rssToken;
245 }
246
247 /**
248 * Set rssLimit.
249 *
250 * @param int $rssLimit
251 *
252 * @return Config
253 */
254 public function setRssLimit($rssLimit)
255 {
256 $this->rssLimit = $rssLimit;
257
258 return $this;
259 }
260
261 /**
262 * Get rssLimit.
263 *
264 * @return int
265 */
266 public function getRssLimit()
267 {
268 return $this->rssLimit;
269 }
270
271 /**
272 * Set readingSpeed.
273 *
274 * @param float $readingSpeed
275 *
276 * @return Config
277 */
278 public function setReadingSpeed($readingSpeed)
279 {
280 $this->readingSpeed = $readingSpeed;
281
282 return $this;
283 }
284
285 /**
286 * Get readingSpeed.
287 *
288 * @return float
289 */
290 public function getReadingSpeed()
291 {
292 return $this->readingSpeed;
293 }
294
295 /**
296 * Set pocketConsumerKey.
297 *
298 * @param string $pocketConsumerKey
299 *
300 * @return Config
301 */
302 public function setPocketConsumerKey($pocketConsumerKey)
303 {
304 $this->pocketConsumerKey = $pocketConsumerKey;
305
306 return $this;
307 }
308
309 /**
310 * Get pocketConsumerKey.
311 *
312 * @return string
313 */
314 public function getPocketConsumerKey()
315 {
316 return $this->pocketConsumerKey;
317 }
318
319 /**
320 * @return int
321 */
322 public function getActionMarkAsRead()
323 {
324 return $this->actionMarkAsRead;
325 }
326
327 /**
328 * @param int $actionMarkAsRead
329 *
330 * @return Config
331 */
332 public function setActionMarkAsRead($actionMarkAsRead)
333 {
334 $this->actionMarkAsRead = $actionMarkAsRead;
335
336 return $this;
337 }
338
339 /**
340 * @param TaggingRule $rule
341 *
342 * @return Config
343 */
344 public function addTaggingRule(TaggingRule $rule)
345 {
346 $this->taggingRules[] = $rule;
347
348 return $this;
349 }
350
351 /**
352 * @return ArrayCollection<TaggingRule>
353 */
354 public function getTaggingRules()
355 {
356 return $this->taggingRules;
357 }
358 }