]>
Commit | Line | Data |
---|---|---|
9d50517c NL |
1 | <?php |
2 | ||
ad4d1caa | 3 | namespace Wallabag\CoreBundle\Entity; |
9d50517c NL |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; | |
55f58c9c | 6 | use Symfony\Component\Validator\Constraints as Assert; |
9d50517c NL |
7 | |
8 | /** | |
9 | * Config | |
10 | * | |
4d85d7e9 | 11 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository") |
9d50517c NL |
12 | * @ORM\Table(name="config") |
13 | * @ORM\Entity | |
14 | */ | |
15 | class Config | |
16 | { | |
17 | /** | |
18 | * @var integer | |
19 | * | |
55f58c9c | 20 | * @ORM\Column(name="id", type="integer") |
9d50517c | 21 | * @ORM\Id |
55f58c9c | 22 | * @ORM\GeneratedValue(strategy="AUTO") |
9d50517c NL |
23 | */ |
24 | private $id; | |
25 | ||
26 | /** | |
27 | * @var string | |
28 | * | |
55f58c9c | 29 | * @Assert\NotBlank() |
4d85d7e9 | 30 | * @ORM\Column(name="theme", type="string", nullable=false) |
9d50517c | 31 | */ |
4d85d7e9 | 32 | private $theme; |
9d50517c NL |
33 | |
34 | /** | |
35 | * @var string | |
36 | * | |
4d85d7e9 J |
37 | * @Assert\NotBlank() |
38 | * @ORM\Column(name="items_per_page", type="integer", nullable=false) | |
39 | */ | |
40 | private $items_per_page; | |
41 | ||
42 | /** | |
43 | * @var string | |
44 | * | |
45 | * @Assert\NotBlank() | |
46 | * @ORM\Column(name="language", type="string", nullable=false) | |
9d50517c | 47 | */ |
4d85d7e9 J |
48 | private $language; |
49 | ||
50 | /** | |
51 | * @ORM\ManyToOne(targetEntity="User", inversedBy="config") | |
52 | */ | |
53 | private $user; | |
54 | ||
55 | /* | |
56 | * @param User $user | |
57 | */ | |
58 | public function __construct(User $user) | |
59 | { | |
60 | $this->user = $user; | |
61 | $this->items_per_page = 12; | |
62 | $this->language = 'en_US'; | |
63 | } | |
9d50517c | 64 | |
9d50517c NL |
65 | /** |
66 | * Get id | |
67 | * | |
7df80cb3 | 68 | * @return integer |
9d50517c NL |
69 | */ |
70 | public function getId() | |
71 | { | |
72 | return $this->id; | |
73 | } | |
74 | ||
75 | /** | |
4d85d7e9 | 76 | * Set theme |
9d50517c | 77 | * |
4d85d7e9 | 78 | * @param string $theme |
9d50517c NL |
79 | * @return Config |
80 | */ | |
4d85d7e9 | 81 | public function setTheme($theme) |
9d50517c | 82 | { |
4d85d7e9 | 83 | $this->theme = $theme; |
9d50517c NL |
84 | |
85 | return $this; | |
86 | } | |
87 | ||
88 | /** | |
4d85d7e9 | 89 | * Get theme |
9d50517c | 90 | * |
7df80cb3 | 91 | * @return string |
9d50517c | 92 | */ |
4d85d7e9 | 93 | public function getTheme() |
9d50517c | 94 | { |
4d85d7e9 | 95 | return $this->theme; |
9d50517c NL |
96 | } |
97 | ||
98 | /** | |
4d85d7e9 | 99 | * Set items_per_page |
9d50517c | 100 | * |
4d85d7e9 | 101 | * @param integer $itemsPerPage |
9d50517c NL |
102 | * @return Config |
103 | */ | |
4d85d7e9 | 104 | public function setItemsPerPage($itemsPerPage) |
9d50517c | 105 | { |
4d85d7e9 | 106 | $this->items_per_page = $itemsPerPage; |
9d50517c NL |
107 | |
108 | return $this; | |
109 | } | |
110 | ||
111 | /** | |
4d85d7e9 J |
112 | * Get items_per_page |
113 | * | |
114 | * @return integer | |
115 | */ | |
116 | public function getItemsPerPage() | |
117 | { | |
118 | return $this->items_per_page; | |
119 | } | |
120 | ||
121 | /** | |
122 | * Set language | |
123 | * | |
124 | * @param string $language | |
125 | * @return Config | |
126 | */ | |
127 | public function setLanguage($language) | |
128 | { | |
129 | $this->language = $language; | |
130 | ||
131 | return $this; | |
132 | } | |
133 | ||
134 | /** | |
135 | * Get language | |
9d50517c | 136 | * |
7df80cb3 | 137 | * @return string |
9d50517c | 138 | */ |
4d85d7e9 J |
139 | public function getLanguage() |
140 | { | |
141 | return $this->language; | |
142 | } | |
143 | ||
144 | /** | |
145 | * Set user | |
146 | * | |
147 | * @param \Wallabag\CoreBundle\Entity\User $user | |
148 | * @return Config | |
149 | */ | |
150 | public function setUser(\Wallabag\CoreBundle\Entity\User $user = null) | |
151 | { | |
152 | $this->user = $user; | |
153 | ||
154 | return $this; | |
155 | } | |
156 | ||
157 | /** | |
158 | * Get user | |
159 | * | |
160 | * @return \Wallabag\CoreBundle\Entity\User | |
161 | */ | |
162 | public function getUser() | |
9d50517c | 163 | { |
4d85d7e9 | 164 | return $this->user; |
9d50517c NL |
165 | } |
166 | } |