diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-02-11 21:06:32 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-02-16 21:31:58 +0100 |
commit | 55f58c9c5e8c523b7547c5d8199f0efef6941b93 (patch) | |
tree | aa7c8e7ad28ac09dc9e5b18183478c4976e70174 /src | |
parent | 2f6a596760c62efd9e43602f787fa44400d522b3 (diff) | |
download | wallabag-55f58c9c5e8c523b7547c5d8199f0efef6941b93.tar.gz wallabag-55f58c9c5e8c523b7547c5d8199f0efef6941b93.tar.zst wallabag-55f58c9c5e8c523b7547c5d8199f0efef6941b93.zip |
Update UserConfig schema
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 12 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Config.php | 8 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/UsersConfig.php | 50 |
3 files changed, 35 insertions, 35 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index feaaebf6..bf2f747d 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -136,18 +136,18 @@ class InstallCommand extends ContainerAwareCommand | |||
136 | $em->persist($user); | 136 | $em->persist($user); |
137 | 137 | ||
138 | $pagerConfig = new UsersConfig(); | 138 | $pagerConfig = new UsersConfig(); |
139 | $pagerConfig->setUserId($user->getId()); | 139 | $pagerConfig->setUser($user); |
140 | $pagerConfig->setName('pager'); | 140 | $pagerConfig->setName('pager'); |
141 | $pagerConfig->setValue(10); | 141 | $pagerConfig->setValue(10); |
142 | 142 | ||
143 | $em->persist($pagerConfig); | 143 | $em->persist($pagerConfig); |
144 | 144 | ||
145 | // $languageConfig = new LanguageConfig(); | 145 | $languageConfig = new LanguageConfig(); |
146 | // $languageConfig->setUserId($user->getId()); | 146 | $languageConfig->setUser($user); |
147 | // $languageConfig->setName('language'); | 147 | $languageConfig->setName('language'); |
148 | // $languageConfig->setValue('en_EN.UTF8'); | 148 | $languageConfig->setValue('en_EN'); |
149 | 149 | ||
150 | // $em->persist($languageConfig); | 150 | $em->persist($languageConfig); |
151 | 151 | ||
152 | $em->flush(); | 152 | $em->flush(); |
153 | } | 153 | } |
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 045ca308..14977d32 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Entity; | 3 | namespace Wallabag\CoreBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Symfony\Component\Validator\Constraints as Assert; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * Config | 9 | * Config |
@@ -15,16 +16,17 @@ class Config | |||
15 | /** | 16 | /** |
16 | * @var integer | 17 | * @var integer |
17 | * | 18 | * |
18 | * @ORM\Column(name="id", type="integer", nullable=false) | 19 | * @ORM\Column(name="id", type="integer") |
19 | * @ORM\Id | 20 | * @ORM\Id |
20 | * @ORM\GeneratedValue(strategy="IDENTITY") | 21 | * @ORM\GeneratedValue(strategy="AUTO") |
21 | */ | 22 | */ |
22 | private $id; | 23 | private $id; |
23 | 24 | ||
24 | /** | 25 | /** |
25 | * @var string | 26 | * @var string |
26 | * | 27 | * |
27 | * @ORM\Column(name="name", type="string", nullable=true) | 28 | * @Assert\NotBlank() |
29 | * @ORM\Column(name="name", type="string", nullable=false) | ||
28 | */ | 30 | */ |
29 | private $name; | 31 | private $name; |
30 | 32 | ||
diff --git a/src/Wallabag/CoreBundle/Entity/UsersConfig.php b/src/Wallabag/CoreBundle/Entity/UsersConfig.php index 0742edbc..52127631 100644 --- a/src/Wallabag/CoreBundle/Entity/UsersConfig.php +++ b/src/Wallabag/CoreBundle/Entity/UsersConfig.php | |||
@@ -22,11 +22,9 @@ class UsersConfig | |||
22 | private $id; | 22 | private $id; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @var string | 25 | * @ORM\ManyToOne(targetEntity="User", inversedBy="config") |
26 | * | ||
27 | * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true) | ||
28 | */ | 26 | */ |
29 | private $userId; | 27 | private $user; |
30 | 28 | ||
31 | /** | 29 | /** |
32 | * @var string | 30 | * @var string |
@@ -53,71 +51,71 @@ class UsersConfig | |||
53 | } | 51 | } |
54 | 52 | ||
55 | /** | 53 | /** |
56 | * Set userId | 54 | * Set name |
57 | * | 55 | * |
58 | * @param string $userId | 56 | * @param string $name |
59 | * @return UsersConfig | 57 | * @return UsersConfig |
60 | */ | 58 | */ |
61 | public function setUserId($userId) | 59 | public function setName($name) |
62 | { | 60 | { |
63 | $this->userId = $userId; | 61 | $this->name = $name; |
64 | 62 | ||
65 | return $this; | 63 | return $this; |
66 | } | 64 | } |
67 | 65 | ||
68 | /** | 66 | /** |
69 | * Get userId | 67 | * Get name |
70 | * | 68 | * |
71 | * @return string | 69 | * @return string |
72 | */ | 70 | */ |
73 | public function getUserId() | 71 | public function getName() |
74 | { | 72 | { |
75 | return $this->userId; | 73 | return $this->name; |
76 | } | 74 | } |
77 | 75 | ||
78 | /** | 76 | /** |
79 | * Set name | 77 | * Set value |
80 | * | 78 | * |
81 | * @param string $name | 79 | * @param string $value |
82 | * @return UsersConfig | 80 | * @return UsersConfig |
83 | */ | 81 | */ |
84 | public function setName($name) | 82 | public function setValue($value) |
85 | { | 83 | { |
86 | $this->name = $name; | 84 | $this->value = $value; |
87 | 85 | ||
88 | return $this; | 86 | return $this; |
89 | } | 87 | } |
90 | 88 | ||
91 | /** | 89 | /** |
92 | * Get name | 90 | * Get value |
93 | * | 91 | * |
94 | * @return string | 92 | * @return string |
95 | */ | 93 | */ |
96 | public function getName() | 94 | public function getValue() |
97 | { | 95 | { |
98 | return $this->name; | 96 | return $this->value; |
99 | } | 97 | } |
100 | 98 | ||
101 | /** | 99 | /** |
102 | * Set value | 100 | * Set user |
103 | * | 101 | * |
104 | * @param string $value | 102 | * @param \Wallabag\CoreBundle\Entity\User $user |
105 | * @return UsersConfig | 103 | * @return UsersConfig |
106 | */ | 104 | */ |
107 | public function setValue($value) | 105 | public function setUser(\Wallabag\CoreBundle\Entity\User $user = null) |
108 | { | 106 | { |
109 | $this->value = $value; | 107 | $this->user = $user; |
110 | 108 | ||
111 | return $this; | 109 | return $this; |
112 | } | 110 | } |
113 | 111 | ||
114 | /** | 112 | /** |
115 | * Get value | 113 | * Get user |
116 | * | 114 | * |
117 | * @return string | 115 | * @return \Wallabag\CoreBundle\Entity\User |
118 | */ | 116 | */ |
119 | public function getValue() | 117 | public function getUser() |
120 | { | 118 | { |
121 | return $this->value; | 119 | return $this->user; |
122 | } | 120 | } |
123 | } | 121 | } |