aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy <j0k3r@users.noreply.github.com>2015-02-06 14:23:55 +0100
committerJeremy <j0k3r@users.noreply.github.com>2015-02-06 14:23:55 +0100
commit15d33c24dca0fc5b8b783eb68bd83f286481f364 (patch)
treed6ca676390279306bdfa8e40e536ec437acd9d18 /src
parent29c4517f7a8ed08239e5bee3d6c3fa823a83d102 (diff)
parent2f69eb4afa2c923cddca2ba0d16d8d7b0bc97680 (diff)
downloadwallabag-15d33c24dca0fc5b8b783eb68bd83f286481f364.tar.gz
wallabag-15d33c24dca0fc5b8b783eb68bd83f286481f364.tar.zst
wallabag-15d33c24dca0fc5b8b783eb68bd83f286481f364.zip
Merge pull request #1060 from wallabag/api-rename-user
rename User entity
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php4
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php (renamed from src/Wallabag/CoreBundle/Entity/Users.php)68
3 files changed, 60 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 32180020..feaaebf6 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -5,7 +5,7 @@ namespace Wallabag\CoreBundle\Command;
5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6use Symfony\Component\Console\Input\InputInterface; 6use Symfony\Component\Console\Input\InputInterface;
7use Symfony\Component\Console\Output\OutputInterface; 7use Symfony\Component\Console\Output\OutputInterface;
8use Wallabag\CoreBundle\Entity\Users; 8use Wallabag\CoreBundle\Entity\User;
9use Wallabag\CoreBundle\Entity\UsersConfig; 9use Wallabag\CoreBundle\Entity\UsersConfig;
10 10
11class InstallCommand extends ContainerAwareCommand 11class InstallCommand extends ContainerAwareCommand
@@ -128,7 +128,7 @@ class InstallCommand extends ContainerAwareCommand
128 $dialog = $this->getHelperSet()->get('dialog'); 128 $dialog = $this->getHelperSet()->get('dialog');
129 $em = $this->getContainer()->get('doctrine.orm.entity_manager'); 129 $em = $this->getContainer()->get('doctrine.orm.entity_manager');
130 130
131 $user = new Users(); 131 $user = new User();
132 $user->setUsername($dialog->ask($output, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 132 $user->setUsername($dialog->ask($output, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
133 $user->setPassword($dialog->ask($output, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 133 $user->setPassword($dialog->ask($output, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
134 $user->setEmail($dialog->ask($output, '<question>Email:</question>', '')); 134 $user->setEmail($dialog->ask($output, '<question>Email:</question>', ''));
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 70c1dc08..a00762ca 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -302,7 +302,7 @@ class Entry
302 } 302 }
303 303
304 /** 304 /**
305 * @return mixed 305 * @return string
306 */ 306 */
307 public function getCreatedAt() 307 public function getCreatedAt()
308 { 308 {
diff --git a/src/Wallabag/CoreBundle/Entity/Users.php b/src/Wallabag/CoreBundle/Entity/User.php
index e0b1fb39..6abfd3ae 100644
--- a/src/Wallabag/CoreBundle/Entity/Users.php
+++ b/src/Wallabag/CoreBundle/Entity/User.php
@@ -7,30 +7,33 @@ use Symfony\Component\Security\Core\User\UserInterface;
7use Symfony\Component\Security\Core\User\AdvancedUserInterface; 7use Symfony\Component\Security\Core\User\AdvancedUserInterface;
8 8
9/** 9/**
10 * Users 10 * User
11 * 11 *
12 * @ORM\Table(name="users") 12 * @ORM\Table(name="user")
13 * @ORM\Entity 13 * @ORM\Entity
14 * @ORM\HasLifecycleCallbacks()
14 */ 15 */
15class Users implements AdvancedUserInterface, \Serializable 16class User implements AdvancedUserInterface, \Serializable
16{ 17{
17 /** 18 /**
18 * @var integer 19 * @var integer
19 * 20 *
20 * @ORM\Column(name="id", type="integer", nullable=true) 21 * @ORM\Column(name="id", type="integer")
21 * @ORM\Id 22 * @ORM\Id
22 * @ORM\GeneratedValue(strategy="IDENTITY") 23 * @ORM\GeneratedValue(strategy="AUTO")
23 */ 24 */
24 private $id; 25 private $id;
25 26
26 /** 27 /**
27 * @var string 28 * @var string
28 * 29 *
29 * @ORM\Column(name="username", type="text", nullable=true) 30 * @ORM\Column(name="username", type="text")
30 */ 31 */
31 private $username; 32 private $username;
32 33
33 /** 34 /**
35 * @var string
36 *
34 * @ORM\Column(type="string", length=32) 37 * @ORM\Column(type="string", length=32)
35 */ 38 */
36 private $salt; 39 private $salt;
@@ -38,7 +41,7 @@ class Users implements AdvancedUserInterface, \Serializable
38 /** 41 /**
39 * @var string 42 * @var string
40 * 43 *
41 * @ORM\Column(name="password", type="text", nullable=true) 44 * @ORM\Column(name="password", type="text")
42 */ 45 */
43 private $password; 46 private $password;
44 47
@@ -61,6 +64,20 @@ class Users implements AdvancedUserInterface, \Serializable
61 */ 64 */
62 private $isActive; 65 private $isActive;
63 66
67 /**
68 * @var date
69 *
70 * @ORM\Column(name="created_at", type="datetime")
71 */
72 private $createdAt;
73
74 /**
75 * @var date
76 *
77 * @ORM\Column(name="updated_at", type="datetime")
78 */
79 private $updatedAt;
80
64 public function __construct() 81 public function __construct()
65 { 82 {
66 $this->isActive = true; 83 $this->isActive = true;
@@ -68,6 +85,19 @@ class Users implements AdvancedUserInterface, \Serializable
68 } 85 }
69 86
70 /** 87 /**
88 * @ORM\PrePersist
89 * @ORM\PreUpdate
90 */
91 public function timestamps()
92 {
93 if (is_null($this->createdAt)) {
94 $this->createdAt = new \DateTime();
95 }
96
97 $this->updatedAt = new \DateTime();
98 }
99
100 /**
71 * Get id 101 * Get id
72 * 102 *
73 * @return integer 103 * @return integer
@@ -81,7 +111,7 @@ class Users implements AdvancedUserInterface, \Serializable
81 * Set username 111 * Set username
82 * 112 *
83 * @param string $username 113 * @param string $username
84 * @return Users 114 * @return User
85 */ 115 */
86 public function setUsername($username) 116 public function setUsername($username)
87 { 117 {
@@ -120,7 +150,7 @@ class Users implements AdvancedUserInterface, \Serializable
120 * Set password 150 * Set password
121 * 151 *
122 * @param string $password 152 * @param string $password
123 * @return Users 153 * @return User
124 */ 154 */
125 public function setPassword($password) 155 public function setPassword($password)
126 { 156 {
@@ -143,7 +173,7 @@ class Users implements AdvancedUserInterface, \Serializable
143 * Set name 173 * Set name
144 * 174 *
145 * @param string $name 175 * @param string $name
146 * @return Users 176 * @return User
147 */ 177 */
148 public function setName($name) 178 public function setName($name)
149 { 179 {
@@ -166,7 +196,7 @@ class Users implements AdvancedUserInterface, \Serializable
166 * Set email 196 * Set email
167 * 197 *
168 * @param string $email 198 * @param string $email
169 * @return Users 199 * @return User
170 */ 200 */
171 public function setEmail($email) 201 public function setEmail($email)
172 { 202 {
@@ -186,6 +216,22 @@ class Users implements AdvancedUserInterface, \Serializable
186 } 216 }
187 217
188 /** 218 /**
219 * @return string
220 */
221 public function getCreatedAt()
222 {
223 return $this->createdAt;
224 }
225
226 /**
227 * @return string
228 */
229 public function getUpdatedAt()
230 {
231 return $this->updatedAt;
232 }
233
234 /**
189 * @inheritDoc 235 * @inheritDoc
190 */ 236 */
191 public function eraseCredentials() 237 public function eraseCredentials()