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