aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Config.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php113
1 files changed, 93 insertions, 20 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index 045ca308..7b4464a1 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -3,10 +3,12 @@
3namespace Wallabag\CoreBundle\Entity; 3namespace Wallabag\CoreBundle\Entity;
4 4
5use Doctrine\ORM\Mapping as ORM; 5use Doctrine\ORM\Mapping as ORM;
6use Symfony\Component\Validator\Constraints as Assert;
6 7
7/** 8/**
8 * Config 9 * Config
9 * 10 *
11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
10 * @ORM\Table(name="config") 12 * @ORM\Table(name="config")
11 * @ORM\Entity 13 * @ORM\Entity
12 */ 14 */
@@ -15,25 +17,50 @@ class Config
15 /** 17 /**
16 * @var integer 18 * @var integer
17 * 19 *
18 * @ORM\Column(name="id", type="integer", nullable=false) 20 * @ORM\Column(name="id", type="integer")
19 * @ORM\Id 21 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY") 22 * @ORM\GeneratedValue(strategy="AUTO")
21 */ 23 */
22 private $id; 24 private $id;
23 25
24 /** 26 /**
25 * @var string 27 * @var string
26 * 28 *
27 * @ORM\Column(name="name", type="string", nullable=true) 29 * @Assert\NotBlank()
30 * @ORM\Column(name="theme", type="string", nullable=false)
28 */ 31 */
29 private $name; 32 private $theme;
30 33
31 /** 34 /**
32 * @var string 35 * @var string
33 * 36 *
34 * @ORM\Column(name="value", type="blob", nullable=true) 37 * @Assert\NotBlank()
38 * @ORM\Column(name="items_per_page", type="integer", nullable=false)
35 */ 39 */
36 private $value; 40 private $items_per_page;
41
42 /**
43 * @var string
44 *
45 * @Assert\NotBlank()
46 * @ORM\Column(name="language", type="string", nullable=false)
47 */
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 }
37 64
38 /** 65 /**
39 * Get id 66 * Get id
@@ -46,48 +73,94 @@ class Config
46 } 73 }
47 74
48 /** 75 /**
49 * Set name 76 * Set theme
50 * 77 *
51 * @param string $name 78 * @param string $theme
52 * @return Config 79 * @return Config
53 */ 80 */
54 public function setName($name) 81 public function setTheme($theme)
55 { 82 {
56 $this->name = $name; 83 $this->theme = $theme;
57 84
58 return $this; 85 return $this;
59 } 86 }
60 87
61 /** 88 /**
62 * Get name 89 * Get theme
63 * 90 *
64 * @return string 91 * @return string
65 */ 92 */
66 public function getName() 93 public function getTheme()
67 { 94 {
68 return $this->name; 95 return $this->theme;
69 } 96 }
70 97
71 /** 98 /**
72 * Set value 99 * Set items_per_page
73 * 100 *
74 * @param string $value 101 * @param integer $itemsPerPage
75 * @return Config 102 * @return Config
76 */ 103 */
77 public function setValue($value) 104 public function setItemsPerPage($itemsPerPage)
78 { 105 {
79 $this->value = $value; 106 $this->items_per_page = $itemsPerPage;
80 107
81 return $this; 108 return $this;
82 } 109 }
83 110
84 /** 111 /**
85 * Get value 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
86 * 136 *
87 * @return string 137 * @return string
88 */ 138 */
89 public function getValue() 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()
90 { 163 {
91 return $this->value; 164 return $this->user;
92 } 165 }
93} 166}