]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Entity/Config.php
Merge pull request #2418 from wallabag/add-twitter-cards
[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{
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
4d85d7e9 90 /**
1210dae1 91 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
4d85d7e9
J
92 */
93 private $user;
94
ac9fec61
KG
95 /**
96 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
752b90d1 97 * @ORM\OrderBy({"id" = "ASC"})
ac9fec61
KG
98 */
99 private $taggingRules;
100
4d85d7e9
J
101 /*
102 * @param User $user
103 */
8eedc8cf 104 public function __construct(User $user)
4d85d7e9
J
105 {
106 $this->user = $user;
ac9fec61 107 $this->taggingRules = new ArrayCollection();
4d85d7e9 108 }
9d50517c 109
9d50517c 110 /**
4346a860 111 * Get id.
9d50517c 112 *
4346a860 113 * @return int
9d50517c
NL
114 */
115 public function getId()
116 {
117 return $this->id;
118 }
119
120 /**
4346a860
JB
121 * Set theme.
122 *
123 * @param string $theme
9d50517c 124 *
9d50517c
NL
125 * @return Config
126 */
4d85d7e9 127 public function setTheme($theme)
9d50517c 128 {
4d85d7e9 129 $this->theme = $theme;
9d50517c
NL
130
131 return $this;
132 }
133
134 /**
4346a860 135 * Get theme.
9d50517c 136 *
7df80cb3 137 * @return string
9d50517c 138 */
4d85d7e9 139 public function getTheme()
9d50517c 140 {
4d85d7e9 141 return $this->theme;
9d50517c
NL
142 }
143
144 /**
4346a860
JB
145 * Set itemsPerPage.
146 *
147 * @param int $itemsPerPage
9d50517c 148 *
9d50517c
NL
149 * @return Config
150 */
4d85d7e9 151 public function setItemsPerPage($itemsPerPage)
9d50517c 152 {
0c83fd59 153 $this->itemsPerPage = $itemsPerPage;
9d50517c
NL
154
155 return $this;
156 }
157
158 /**
4346a860 159 * Get itemsPerPage.
4d85d7e9 160 *
4346a860 161 * @return int
4d85d7e9
J
162 */
163 public function getItemsPerPage()
164 {
0c83fd59 165 return $this->itemsPerPage;
4d85d7e9
J
166 }
167
168 /**
4346a860
JB
169 * Set language.
170 *
171 * @param string $language
4d85d7e9 172 *
4d85d7e9
J
173 * @return Config
174 */
175 public function setLanguage($language)
176 {
177 $this->language = $language;
178
179 return $this;
180 }
181
182 /**
4346a860 183 * Get language.
9d50517c 184 *
7df80cb3 185 * @return string
9d50517c 186 */
4d85d7e9
J
187 public function getLanguage()
188 {
189 return $this->language;
190 }
191
192 /**
4346a860
JB
193 * Set user.
194 *
1210dae1 195 * @param User $user
4d85d7e9 196 *
4d85d7e9
J
197 * @return Config
198 */
8eedc8cf 199 public function setUser(User $user = null)
4d85d7e9
J
200 {
201 $this->user = $user;
202
203 return $this;
204 }
205
206 /**
4346a860 207 * Get user.
4d85d7e9 208 *
1210dae1 209 * @return User
4d85d7e9
J
210 */
211 public function getUser()
9d50517c 212 {
4d85d7e9 213 return $this->user;
9d50517c 214 }
0c83fd59
J
215
216 /**
4346a860
JB
217 * Set rssToken.
218 *
219 * @param string $rssToken
0c83fd59 220 *
0c83fd59
J
221 * @return Config
222 */
223 public function setRssToken($rssToken)
224 {
225 $this->rssToken = $rssToken;
226
227 return $this;
228 }
229
230 /**
4346a860 231 * Get rssToken.
0c83fd59
J
232 *
233 * @return string
234 */
235 public function getRssToken()
236 {
237 return $this->rssToken;
238 }
239
240 /**
4346a860
JB
241 * Set rssLimit.
242 *
8eedc8cf 243 * @param int $rssLimit
0c83fd59 244 *
0c83fd59
J
245 * @return Config
246 */
247 public function setRssLimit($rssLimit)
248 {
249 $this->rssLimit = $rssLimit;
250
251 return $this;
252 }
253
254 /**
4346a860 255 * Get rssLimit.
0c83fd59 256 *
8eedc8cf 257 * @return int
0c83fd59
J
258 */
259 public function getRssLimit()
260 {
261 return $this->rssLimit;
262 }
ac9fec61 263
bca54859
NL
264 /**
265 * Set readingSpeed.
266 *
1b64a84b 267 * @param float $readingSpeed
bca54859
NL
268 *
269 * @return Config
270 */
271 public function setReadingSpeed($readingSpeed)
272 {
273 $this->readingSpeed = $readingSpeed;
274
275 return $this;
276 }
277
278 /**
279 * Get readingSpeed.
280 *
1b64a84b 281 * @return float
bca54859
NL
282 */
283 public function getReadingSpeed()
284 {
285 return $this->readingSpeed;
286 }
287
ebe0787e
JB
288 /**
289 * Set pocketConsumerKey.
290 *
291 * @param string $pocketConsumerKey
292 *
293 * @return Config
294 */
295 public function setPocketConsumerKey($pocketConsumerKey)
296 {
297 $this->pocketConsumerKey = $pocketConsumerKey;
298
299 return $this;
300 }
301
302 /**
303 * Get pocketConsumerKey.
304 *
305 * @return string
306 */
307 public function getPocketConsumerKey()
308 {
309 return $this->pocketConsumerKey;
310 }
311
ac9fec61
KG
312 /**
313 * @param TaggingRule $rule
314 *
315 * @return Config
316 */
317 public function addTaggingRule(TaggingRule $rule)
318 {
319 $this->taggingRules[] = $rule;
320
321 return $this;
322 }
323
324 /**
325 * @return ArrayCollection<TaggingRule>
326 */
327 public function getTaggingRules()
328 {
329 return $this->taggingRules;
330 }
9d50517c 331}