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