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