]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Entity/Config.php
Merge pull request #2659 from akovalyov/bugfix/non-latin-characters-in-reading-time...
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Config.php
CommitLineData
9d50517c
NL
1<?php
2
ad4d1caa 3namespace Wallabag\CoreBundle\Entity;
9d50517c 4
1d7b350b 5use Doctrine\Common\Collections\ArrayCollection;
9d50517c 6use Doctrine\ORM\Mapping as ORM;
55f58c9c 7use Symfony\Component\Validator\Constraints as Assert;
8eedc8cf 8use Wallabag\UserBundle\Entity\User;
9d50517c
NL
9
10/**
4346a860 11 * Config.
9d50517c 12 *
4d85d7e9 13 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
bd0f3d32 14 * @ORM\Table(name="`config`")
9d50517c
NL
15 * @ORM\Entity
16 */
17class Config
18{
f052f1fd
NL
19 const REDIRECT_TO_HOMEPAGE = 0;
20 const REDIRECT_TO_CURRENT_PAGE = 1;
21
9d50517c 22 /**
4346a860 23 * @var int
9d50517c 24 *
55f58c9c 25 * @ORM\Column(name="id", type="integer")
9d50517c 26 * @ORM\Id
55f58c9c 27 * @ORM\GeneratedValue(strategy="AUTO")
9d50517c
NL
28 */
29 private $id;
30
31 /**
32 * @var string
33 *
55f58c9c 34 * @Assert\NotBlank()
4d85d7e9 35 * @ORM\Column(name="theme", type="string", nullable=false)
9d50517c 36 */
4d85d7e9 37 private $theme;
9d50517c
NL
38
39 /**
4346a860 40 * @var int
9d50517c 41 *
4d85d7e9 42 * @Assert\NotBlank()
371ac69a
J
43 * @Assert\Range(
44 * min = 1,
45 * max = 100000,
0d42217e 46 * maxMessage = "validator.item_per_page_too_high"
371ac69a 47 * )
4d85d7e9
J
48 * @ORM\Column(name="items_per_page", type="integer", nullable=false)
49 */
0c83fd59 50 private $itemsPerPage;
4d85d7e9
J
51
52 /**
53 * @var string
54 *
55 * @Assert\NotBlank()
56 * @ORM\Column(name="language", type="string", nullable=false)
9d50517c 57 */
4d85d7e9
J
58 private $language;
59
0c83fd59
J
60 /**
61 * @var string
62 *
63 * @ORM\Column(name="rss_token", type="string", nullable=true)
64 */
65 private $rssToken;
66
67 /**
4346a860 68 * @var int
0c83fd59
J
69 *
70 * @ORM\Column(name="rss_limit", type="integer", nullable=true)
371ac69a
J
71 * @Assert\Range(
72 * min = 1,
73 * max = 100000,
540a9bc4 74 * maxMessage = "validator.rss_limit_too_high"
371ac69a 75 * )
0c83fd59
J
76 */
77 private $rssLimit;
78
bca54859
NL
79 /**
80 * @var float
81 *
82 * @ORM\Column(name="reading_speed", type="float", nullable=true)
83 */
84 private $readingSpeed;
85
ebe0787e
JB
86 /**
87 * @var string
88 *
89 * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
90 */
91 private $pocketConsumerKey;
92
a42f38d9
NL
93 /**
94 * @var int
95 *
96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true)
97 */
98 private $actionMarkAsRead;
99
4d85d7e9 100 /**
1210dae1 101 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
4d85d7e9
J
102 */
103 private $user;
104
ac9fec61
KG
105 /**
106 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
752b90d1 107 * @ORM\OrderBy({"id" = "ASC"})
ac9fec61
KG
108 */
109 private $taggingRules;
110
4d85d7e9
J
111 /*
112 * @param User $user
113 */
8eedc8cf 114 public function __construct(User $user)
4d85d7e9
J
115 {
116 $this->user = $user;
ac9fec61 117 $this->taggingRules = new ArrayCollection();
4d85d7e9 118 }
9d50517c 119
9d50517c 120 /**
4346a860 121 * Get id.
9d50517c 122 *
4346a860 123 * @return int
9d50517c
NL
124 */
125 public function getId()
126 {
127 return $this->id;
128 }
129
130 /**
4346a860
JB
131 * Set theme.
132 *
133 * @param string $theme
9d50517c 134 *
9d50517c
NL
135 * @return Config
136 */
4d85d7e9 137 public function setTheme($theme)
9d50517c 138 {
4d85d7e9 139 $this->theme = $theme;
9d50517c
NL
140
141 return $this;
142 }
143
144 /**
4346a860 145 * Get theme.
9d50517c 146 *
7df80cb3 147 * @return string
9d50517c 148 */
4d85d7e9 149 public function getTheme()
9d50517c 150 {
4d85d7e9 151 return $this->theme;
9d50517c
NL
152 }
153
154 /**
4346a860
JB
155 * Set itemsPerPage.
156 *
157 * @param int $itemsPerPage
9d50517c 158 *
9d50517c
NL
159 * @return Config
160 */
4d85d7e9 161 public function setItemsPerPage($itemsPerPage)
9d50517c 162 {
0c83fd59 163 $this->itemsPerPage = $itemsPerPage;
9d50517c
NL
164
165 return $this;
166 }
167
168 /**
4346a860 169 * Get itemsPerPage.
4d85d7e9 170 *
4346a860 171 * @return int
4d85d7e9
J
172 */
173 public function getItemsPerPage()
174 {
0c83fd59 175 return $this->itemsPerPage;
4d85d7e9
J
176 }
177
178 /**
4346a860
JB
179 * Set language.
180 *
181 * @param string $language
4d85d7e9 182 *
4d85d7e9
J
183 * @return Config
184 */
185 public function setLanguage($language)
186 {
187 $this->language = $language;
188
189 return $this;
190 }
191
192 /**
4346a860 193 * Get language.
9d50517c 194 *
7df80cb3 195 * @return string
9d50517c 196 */
4d85d7e9
J
197 public function getLanguage()
198 {
199 return $this->language;
200 }
201
202 /**
4346a860
JB
203 * Set user.
204 *
1210dae1 205 * @param User $user
4d85d7e9 206 *
4d85d7e9
J
207 * @return Config
208 */
8eedc8cf 209 public function setUser(User $user = null)
4d85d7e9
J
210 {
211 $this->user = $user;
212
213 return $this;
214 }
215
216 /**
4346a860 217 * Get user.
4d85d7e9 218 *
1210dae1 219 * @return User
4d85d7e9
J
220 */
221 public function getUser()
9d50517c 222 {
4d85d7e9 223 return $this->user;
9d50517c 224 }
0c83fd59
J
225
226 /**
4346a860
JB
227 * Set rssToken.
228 *
229 * @param string $rssToken
0c83fd59 230 *
0c83fd59
J
231 * @return Config
232 */
233 public function setRssToken($rssToken)
234 {
235 $this->rssToken = $rssToken;
236
237 return $this;
238 }
239
240 /**
4346a860 241 * Get rssToken.
0c83fd59
J
242 *
243 * @return string
244 */
245 public function getRssToken()
246 {
247 return $this->rssToken;
248 }
249
250 /**
4346a860
JB
251 * Set rssLimit.
252 *
8eedc8cf 253 * @param int $rssLimit
0c83fd59 254 *
0c83fd59
J
255 * @return Config
256 */
257 public function setRssLimit($rssLimit)
258 {
259 $this->rssLimit = $rssLimit;
260
261 return $this;
262 }
263
264 /**
4346a860 265 * Get rssLimit.
0c83fd59 266 *
8eedc8cf 267 * @return int
0c83fd59
J
268 */
269 public function getRssLimit()
270 {
271 return $this->rssLimit;
272 }
ac9fec61 273
bca54859
NL
274 /**
275 * Set readingSpeed.
276 *
1b64a84b 277 * @param float $readingSpeed
bca54859
NL
278 *
279 * @return Config
280 */
281 public function setReadingSpeed($readingSpeed)
282 {
283 $this->readingSpeed = $readingSpeed;
284
285 return $this;
286 }
287
288 /**
289 * Get readingSpeed.
290 *
1b64a84b 291 * @return float
bca54859
NL
292 */
293 public function getReadingSpeed()
294 {
295 return $this->readingSpeed;
296 }
297
ebe0787e
JB
298 /**
299 * Set pocketConsumerKey.
300 *
301 * @param string $pocketConsumerKey
302 *
303 * @return Config
304 */
305 public function setPocketConsumerKey($pocketConsumerKey)
306 {
307 $this->pocketConsumerKey = $pocketConsumerKey;
308
309 return $this;
310 }
311
312 /**
313 * Get pocketConsumerKey.
314 *
315 * @return string
316 */
317 public function getPocketConsumerKey()
318 {
319 return $this->pocketConsumerKey;
320 }
321
a42f38d9
NL
322 /**
323 * @return int
324 */
325 public function getActionMarkAsRead()
326 {
327 return $this->actionMarkAsRead;
328 }
329
330 /**
331 * @param int $actionMarkAsRead
332 *
333 * @return Config
334 */
335 public function setActionMarkAsRead($actionMarkAsRead)
336 {
337 $this->actionMarkAsRead = $actionMarkAsRead;
338
339 return $this;
340 }
341
ac9fec61
KG
342 /**
343 * @param TaggingRule $rule
344 *
345 * @return Config
346 */
347 public function addTaggingRule(TaggingRule $rule)
348 {
349 $this->taggingRules[] = $rule;
350
351 return $this;
352 }
353
354 /**
355 * @return ArrayCollection<TaggingRule>
356 */
357 public function getTaggingRules()
358 {
359 return $this->taggingRules;
360 }
9d50517c 361}