aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-02-16 21:28:49 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-02-16 21:31:58 +0100
commit4d85d7e9ba676bd5ac3428976ce9227f460eb542 (patch)
treeacf77c5baced69e689fcfc2d9463a9b75b9b3657 /src/Wallabag/CoreBundle/Entity
parent7a577c519ffc254b6ddecd75c9ee84f656d759e1 (diff)
downloadwallabag-4d85d7e9ba676bd5ac3428976ce9227f460eb542.tar.gz
wallabag-4d85d7e9ba676bd5ac3428976ce9227f460eb542.tar.zst
wallabag-4d85d7e9ba676bd5ac3428976ce9227f460eb542.zip
Implement simple config
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php107
-rw-r--r--src/Wallabag/CoreBundle/Entity/UsersConfig.php121
2 files changed, 89 insertions, 139 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index 14977d32..7b4464a1 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -8,6 +8,7 @@ use Symfony\Component\Validator\Constraints as Assert;
8/** 8/**
9 * Config 9 * Config
10 * 10 *
11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
11 * @ORM\Table(name="config") 12 * @ORM\Table(name="config")
12 * @ORM\Entity 13 * @ORM\Entity
13 */ 14 */
@@ -26,16 +27,40 @@ class Config
26 * @var string 27 * @var string
27 * 28 *
28 * @Assert\NotBlank() 29 * @Assert\NotBlank()
29 * @ORM\Column(name="name", type="string", nullable=false) 30 * @ORM\Column(name="theme", type="string", nullable=false)
30 */ 31 */
31 private $name; 32 private $theme;
32 33
33 /** 34 /**
34 * @var string 35 * @var string
35 * 36 *
36 * @ORM\Column(name="value", type="blob", nullable=true) 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)
37 */ 47 */
38 private $value; 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 }
39 64
40 /** 65 /**
41 * Get id 66 * Get id
@@ -48,48 +73,94 @@ class Config
48 } 73 }
49 74
50 /** 75 /**
51 * Set name 76 * Set theme
52 * 77 *
53 * @param string $name 78 * @param string $theme
54 * @return Config 79 * @return Config
55 */ 80 */
56 public function setName($name) 81 public function setTheme($theme)
57 { 82 {
58 $this->name = $name; 83 $this->theme = $theme;
59 84
60 return $this; 85 return $this;
61 } 86 }
62 87
63 /** 88 /**
64 * Get name 89 * Get theme
65 * 90 *
66 * @return string 91 * @return string
67 */ 92 */
68 public function getName() 93 public function getTheme()
69 { 94 {
70 return $this->name; 95 return $this->theme;
71 } 96 }
72 97
73 /** 98 /**
74 * Set value 99 * Set items_per_page
75 * 100 *
76 * @param string $value 101 * @param integer $itemsPerPage
77 * @return Config 102 * @return Config
78 */ 103 */
79 public function setValue($value) 104 public function setItemsPerPage($itemsPerPage)
80 { 105 {
81 $this->value = $value; 106 $this->items_per_page = $itemsPerPage;
82 107
83 return $this; 108 return $this;
84 } 109 }
85 110
86 /** 111 /**
87 * 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
88 * 136 *
89 * @return string 137 * @return string
90 */ 138 */
91 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()
92 { 163 {
93 return $this->value; 164 return $this->user;
94 } 165 }
95} 166}
diff --git a/src/Wallabag/CoreBundle/Entity/UsersConfig.php b/src/Wallabag/CoreBundle/Entity/UsersConfig.php
deleted file mode 100644
index 52127631..00000000
--- a/src/Wallabag/CoreBundle/Entity/UsersConfig.php
+++ /dev/null
@@ -1,121 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * UsersConfig
9 *
10 * @ORM\Table(name="users_config")
11 * @ORM\Entity
12 */
13class UsersConfig
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @ORM\ManyToOne(targetEntity="User", inversedBy="config")
26 */
27 private $user;
28
29 /**
30 * @var string
31 *
32 * @ORM\Column(name="name", type="text", nullable=true)
33 */
34 private $name;
35
36 /**
37 * @var string
38 *
39 * @ORM\Column(name="value", type="text", nullable=true)
40 */
41 private $value;
42
43 /**
44 * Get id
45 *
46 * @return integer
47 */
48 public function getId()
49 {
50 return $this->id;
51 }
52
53 /**
54 * Set name
55 *
56 * @param string $name
57 * @return UsersConfig
58 */
59 public function setName($name)
60 {
61 $this->name = $name;
62
63 return $this;
64 }
65
66 /**
67 * Get name
68 *
69 * @return string
70 */
71 public function getName()
72 {
73 return $this->name;
74 }
75
76 /**
77 * Set value
78 *
79 * @param string $value
80 * @return UsersConfig
81 */
82 public function setValue($value)
83 {
84 $this->value = $value;
85
86 return $this;
87 }
88
89 /**
90 * Get value
91 *
92 * @return string
93 */
94 public function getValue()
95 {
96 return $this->value;
97 }
98
99 /**
100 * Set user
101 *
102 * @param \Wallabag\CoreBundle\Entity\User $user
103 * @return UsersConfig
104 */
105 public function setUser(\Wallabag\CoreBundle\Entity\User $user = null)
106 {
107 $this->user = $user;
108
109 return $this;
110 }
111
112 /**
113 * Get user
114 *
115 * @return \Wallabag\CoreBundle\Entity\User
116 */
117 public function getUser()
118 {
119 return $this->user;
120 }
121}