]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Config.php
Fixed entry shortcuts available in list view
[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)
97 */
98 private $actionMarkAsRead;
99
100 /**
101 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
102 */
103 private $user;
104
105 /**
106 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
107 * @ORM\OrderBy({"id" = "ASC"})
108 */
109 private $taggingRules;
110
111 /*
112 * @param User $user
113 */
114 public function __construct(User $user)
115 {
116 $this->user = $user;
117 $this->taggingRules = new ArrayCollection();
118 }
119
120 /**
121 * Get id.
122 *
123 * @return int
124 */
125 public function getId()
126 {
127 return $this->id;
128 }
129
130 /**
131 * Set theme.
132 *
133 * @param string $theme
134 *
135 * @return Config
136 */
137 public function setTheme($theme)
138 {
139 $this->theme = $theme;
140
141 return $this;
142 }
143
144 /**
145 * Get theme.
146 *
147 * @return string
148 */
149 public function getTheme()
150 {
151 return $this->theme;
152 }
153
154 /**
155 * Set itemsPerPage.
156 *
157 * @param int $itemsPerPage
158 *
159 * @return Config
160 */
161 public function setItemsPerPage($itemsPerPage)
162 {
163 $this->itemsPerPage = $itemsPerPage;
164
165 return $this;
166 }
167
168 /**
169 * Get itemsPerPage.
170 *
171 * @return int
172 */
173 public function getItemsPerPage()
174 {
175 return $this->itemsPerPage;
176 }
177
178 /**
179 * Set language.
180 *
181 * @param string $language
182 *
183 * @return Config
184 */
185 public function setLanguage($language)
186 {
187 $this->language = $language;
188
189 return $this;
190 }
191
192 /**
193 * Get language.
194 *
195 * @return string
196 */
197 public function getLanguage()
198 {
199 return $this->language;
200 }
201
202 /**
203 * Set user.
204 *
205 * @param User $user
206 *
207 * @return Config
208 */
209 public function setUser(User $user = null)
210 {
211 $this->user = $user;
212
213 return $this;
214 }
215
216 /**
217 * Get user.
218 *
219 * @return User
220 */
221 public function getUser()
222 {
223 return $this->user;
224 }
225
226 /**
227 * Set rssToken.
228 *
229 * @param string $rssToken
230 *
231 * @return Config
232 */
233 public function setRssToken($rssToken)
234 {
235 $this->rssToken = $rssToken;
236
237 return $this;
238 }
239
240 /**
241 * Get rssToken.
242 *
243 * @return string
244 */
245 public function getRssToken()
246 {
247 return $this->rssToken;
248 }
249
250 /**
251 * Set rssLimit.
252 *
253 * @param int $rssLimit
254 *
255 * @return Config
256 */
257 public function setRssLimit($rssLimit)
258 {
259 $this->rssLimit = $rssLimit;
260
261 return $this;
262 }
263
264 /**
265 * Get rssLimit.
266 *
267 * @return int
268 */
269 public function getRssLimit()
270 {
271 return $this->rssLimit;
272 }
273
274 /**
275 * Set readingSpeed.
276 *
277 * @param float $readingSpeed
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 *
291 * @return float
292 */
293 public function getReadingSpeed()
294 {
295 return $this->readingSpeed;
296 }
297
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
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
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 }
361 }