]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Config.php
Prepare 2.3.3 release
[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 const REDIRECT_TO_HOMEPAGE = 0;
20 const REDIRECT_TO_CURRENT_PAGE = 1;
21
22 /**
23 * @var int
24 *
25 * @ORM\Column(name="id", type="integer")
26 * @ORM\Id
27 * @ORM\GeneratedValue(strategy="AUTO")
28 */
29 private $id;
30
31 /**
32 * @var string
33 *
34 * @Assert\NotBlank()
35 * @ORM\Column(name="theme", type="string", nullable=false)
36 */
37 private $theme;
38
39 /**
40 * @var int
41 *
42 * @Assert\NotBlank()
43 * @Assert\Range(
44 * min = 1,
45 * max = 100000,
46 * maxMessage = "validator.item_per_page_too_high"
47 * )
48 * @ORM\Column(name="items_per_page", type="integer", nullable=false)
49 */
50 private $itemsPerPage;
51
52 /**
53 * @var string
54 *
55 * @Assert\NotBlank()
56 * @ORM\Column(name="language", type="string", nullable=false)
57 */
58 private $language;
59
60 /**
61 * @var string
62 *
63 * @ORM\Column(name="rss_token", type="string", nullable=true)
64 */
65 private $rssToken;
66
67 /**
68 * @var int
69 *
70 * @ORM\Column(name="rss_limit", type="integer", nullable=true)
71 * @Assert\Range(
72 * min = 1,
73 * max = 100000,
74 * maxMessage = "validator.rss_limit_too_high"
75 * )
76 */
77 private $rssLimit;
78
79 /**
80 * @var float
81 *
82 * @ORM\Column(name="reading_speed", type="float", nullable=true)
83 */
84 private $readingSpeed;
85
86 /**
87 * @var string
88 *
89 * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
90 */
91 private $pocketConsumerKey;
92
93 /**
94 * @var int
95 *
96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true, options={"default" = 0})
97 */
98 private $actionMarkAsRead;
99
100 /**
101 * @var int
102 *
103 * @ORM\Column(name="list_mode", type="integer", nullable=true)
104 */
105 private $listMode;
106
107 /**
108 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
109 */
110 private $user;
111
112 /**
113 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
114 * @ORM\OrderBy({"id" = "ASC"})
115 */
116 private $taggingRules;
117
118 /*
119 * @param User $user
120 */
121 public function __construct(User $user)
122 {
123 $this->user = $user;
124 $this->taggingRules = new ArrayCollection();
125 }
126
127 /**
128 * Get id.
129 *
130 * @return int
131 */
132 public function getId()
133 {
134 return $this->id;
135 }
136
137 /**
138 * Set theme.
139 *
140 * @param string $theme
141 *
142 * @return Config
143 */
144 public function setTheme($theme)
145 {
146 $this->theme = $theme;
147
148 return $this;
149 }
150
151 /**
152 * Get theme.
153 *
154 * @return string
155 */
156 public function getTheme()
157 {
158 return $this->theme;
159 }
160
161 /**
162 * Set itemsPerPage.
163 *
164 * @param int $itemsPerPage
165 *
166 * @return Config
167 */
168 public function setItemsPerPage($itemsPerPage)
169 {
170 $this->itemsPerPage = $itemsPerPage;
171
172 return $this;
173 }
174
175 /**
176 * Get itemsPerPage.
177 *
178 * @return int
179 */
180 public function getItemsPerPage()
181 {
182 return $this->itemsPerPage;
183 }
184
185 /**
186 * Set language.
187 *
188 * @param string $language
189 *
190 * @return Config
191 */
192 public function setLanguage($language)
193 {
194 $this->language = $language;
195
196 return $this;
197 }
198
199 /**
200 * Get language.
201 *
202 * @return string
203 */
204 public function getLanguage()
205 {
206 return $this->language;
207 }
208
209 /**
210 * Set user.
211 *
212 * @param User $user
213 *
214 * @return Config
215 */
216 public function setUser(User $user = null)
217 {
218 $this->user = $user;
219
220 return $this;
221 }
222
223 /**
224 * Get user.
225 *
226 * @return User
227 */
228 public function getUser()
229 {
230 return $this->user;
231 }
232
233 /**
234 * Set rssToken.
235 *
236 * @param string $rssToken
237 *
238 * @return Config
239 */
240 public function setRssToken($rssToken)
241 {
242 $this->rssToken = $rssToken;
243
244 return $this;
245 }
246
247 /**
248 * Get rssToken.
249 *
250 * @return string
251 */
252 public function getRssToken()
253 {
254 return $this->rssToken;
255 }
256
257 /**
258 * Set rssLimit.
259 *
260 * @param int $rssLimit
261 *
262 * @return Config
263 */
264 public function setRssLimit($rssLimit)
265 {
266 $this->rssLimit = $rssLimit;
267
268 return $this;
269 }
270
271 /**
272 * Get rssLimit.
273 *
274 * @return int
275 */
276 public function getRssLimit()
277 {
278 return $this->rssLimit;
279 }
280
281 /**
282 * Set readingSpeed.
283 *
284 * @param float $readingSpeed
285 *
286 * @return Config
287 */
288 public function setReadingSpeed($readingSpeed)
289 {
290 $this->readingSpeed = $readingSpeed;
291
292 return $this;
293 }
294
295 /**
296 * Get readingSpeed.
297 *
298 * @return float
299 */
300 public function getReadingSpeed()
301 {
302 return $this->readingSpeed;
303 }
304
305 /**
306 * Set pocketConsumerKey.
307 *
308 * @param string $pocketConsumerKey
309 *
310 * @return Config
311 */
312 public function setPocketConsumerKey($pocketConsumerKey)
313 {
314 $this->pocketConsumerKey = $pocketConsumerKey;
315
316 return $this;
317 }
318
319 /**
320 * Get pocketConsumerKey.
321 *
322 * @return string
323 */
324 public function getPocketConsumerKey()
325 {
326 return $this->pocketConsumerKey;
327 }
328
329 /**
330 * @return int
331 */
332 public function getActionMarkAsRead()
333 {
334 return $this->actionMarkAsRead;
335 }
336
337 /**
338 * @param int $actionMarkAsRead
339 *
340 * @return Config
341 */
342 public function setActionMarkAsRead($actionMarkAsRead)
343 {
344 $this->actionMarkAsRead = $actionMarkAsRead;
345
346 return $this;
347 }
348
349 /**
350 * @return int
351 */
352 public function getListMode()
353 {
354 return $this->listMode;
355 }
356
357 /**
358 * @param int $listMode
359 *
360 * @return Config
361 */
362 public function setListMode($listMode)
363 {
364 $this->listMode = $listMode;
365
366 return $this;
367 }
368
369 /**
370 * @param TaggingRule $rule
371 *
372 * @return Config
373 */
374 public function addTaggingRule(TaggingRule $rule)
375 {
376 $this->taggingRules[] = $rule;
377
378 return $this;
379 }
380
381 /**
382 * @return ArrayCollection<TaggingRule>
383 */
384 public function getTaggingRules()
385 {
386 return $this->taggingRules;
387 }
388 }