]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Entity/Config.php
Added setting to have a personal reading time
[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 /**
20 * @var int
21 *
22 * @ORM\Column(name="id", type="integer")
23 * @ORM\Id
24 * @ORM\GeneratedValue(strategy="AUTO")
25 */
26 private $id;
27
28 /**
29 * @var string
30 *
31 * @Assert\NotBlank()
32 * @ORM\Column(name="theme", type="string", nullable=false)
33 */
34 private $theme;
35
36 /**
37 * @var int
38 *
39 * @Assert\NotBlank()
40 * @Assert\Range(
41 * min = 1,
42 * max = 100000,
43 * maxMessage = "This will certainly kill the app"
44 * )
45 * @ORM\Column(name="items_per_page", type="integer", nullable=false)
46 */
47 private $itemsPerPage;
48
49 /**
50 * @var string
51 *
52 * @Assert\NotBlank()
53 * @ORM\Column(name="language", type="string", nullable=false)
54 */
55 private $language;
56
57 /**
58 * @var string
59 *
60 * @ORM\Column(name="rss_token", type="string", nullable=true)
61 */
62 private $rssToken;
63
64 /**
65 * @var int
66 *
67 * @ORM\Column(name="rss_limit", type="integer", nullable=true)
68 * @Assert\Range(
69 * min = 1,
70 * max = 100000,
71 * maxMessage = "This will certainly kill the app"
72 * )
73 */
74 private $rssLimit;
75
76 /**
77 * @var float
78 *
79 * @ORM\Column(name="reading_speed", type="float", nullable=true)
80 */
81 private $readingSpeed;
82
83 /**
84 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
85 */
86 private $user;
87
88 /**
89 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
90 * @ORM\OrderBy({"id" = "ASC"})
91 */
92 private $taggingRules;
93
94 /*
95 * @param User $user
96 */
97 public function __construct(User $user)
98 {
99 $this->user = $user;
100 $this->taggingRules = new ArrayCollection();
101 }
102
103 /**
104 * Get id.
105 *
106 * @return int
107 */
108 public function getId()
109 {
110 return $this->id;
111 }
112
113 /**
114 * Set theme.
115 *
116 * @param string $theme
117 *
118 * @return Config
119 */
120 public function setTheme($theme)
121 {
122 $this->theme = $theme;
123
124 return $this;
125 }
126
127 /**
128 * Get theme.
129 *
130 * @return string
131 */
132 public function getTheme()
133 {
134 return $this->theme;
135 }
136
137 /**
138 * Set itemsPerPage.
139 *
140 * @param int $itemsPerPage
141 *
142 * @return Config
143 */
144 public function setItemsPerPage($itemsPerPage)
145 {
146 $this->itemsPerPage = $itemsPerPage;
147
148 return $this;
149 }
150
151 /**
152 * Get itemsPerPage.
153 *
154 * @return int
155 */
156 public function getItemsPerPage()
157 {
158 return $this->itemsPerPage;
159 }
160
161 /**
162 * Set language.
163 *
164 * @param string $language
165 *
166 * @return Config
167 */
168 public function setLanguage($language)
169 {
170 $this->language = $language;
171
172 return $this;
173 }
174
175 /**
176 * Get language.
177 *
178 * @return string
179 */
180 public function getLanguage()
181 {
182 return $this->language;
183 }
184
185 /**
186 * Set user.
187 *
188 * @param User $user
189 *
190 * @return Config
191 */
192 public function setUser(User $user = null)
193 {
194 $this->user = $user;
195
196 return $this;
197 }
198
199 /**
200 * Get user.
201 *
202 * @return User
203 */
204 public function getUser()
205 {
206 return $this->user;
207 }
208
209 /**
210 * Set rssToken.
211 *
212 * @param string $rssToken
213 *
214 * @return Config
215 */
216 public function setRssToken($rssToken)
217 {
218 $this->rssToken = $rssToken;
219
220 return $this;
221 }
222
223 /**
224 * Get rssToken.
225 *
226 * @return string
227 */
228 public function getRssToken()
229 {
230 return $this->rssToken;
231 }
232
233 /**
234 * Set rssLimit.
235 *
236 * @param int $rssLimit
237 *
238 * @return Config
239 */
240 public function setRssLimit($rssLimit)
241 {
242 $this->rssLimit = $rssLimit;
243
244 return $this;
245 }
246
247 /**
248 * Get rssLimit.
249 *
250 * @return int
251 */
252 public function getRssLimit()
253 {
254 return $this->rssLimit;
255 }
256
257 /**
258 * Set readingSpeed.
259 *
260 * @param int $readingSpeed
261 *
262 * @return Config
263 */
264 public function setReadingSpeed($readingSpeed)
265 {
266 $this->readingSpeed = $readingSpeed;
267
268 return $this;
269 }
270
271 /**
272 * Get readingSpeed.
273 *
274 * @return int
275 */
276 public function getReadingSpeed()
277 {
278 return $this->readingSpeed;
279 }
280
281 /**
282 * @param TaggingRule $rule
283 *
284 * @return Config
285 */
286 public function addTaggingRule(TaggingRule $rule)
287 {
288 $this->taggingRules[] = $rule;
289
290 return $this;
291 }
292
293 /**
294 * @return ArrayCollection<TaggingRule>
295 */
296 public function getTaggingRules()
297 {
298 return $this->taggingRules;
299 }
300 }