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