mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-15 20:26:27 +00:00
Merge pull request #1060 from wallabag/api-rename-user
rename User entity
This commit is contained in:
commit
15d33c24dc
3 changed files with 60 additions and 14 deletions
|
@ -5,7 +5,7 @@ namespace Wallabag\CoreBundle\Command;
|
|||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Wallabag\CoreBundle\Entity\Users;
|
||||
use Wallabag\CoreBundle\Entity\User;
|
||||
use Wallabag\CoreBundle\Entity\UsersConfig;
|
||||
|
||||
class InstallCommand extends ContainerAwareCommand
|
||||
|
@ -128,7 +128,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
|
||||
$user = new Users();
|
||||
$user = new User();
|
||||
$user->setUsername($dialog->ask($output, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||
$user->setPassword($dialog->ask($output, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||
$user->setEmail($dialog->ask($output, '<question>Email:</question>', ''));
|
||||
|
|
|
@ -302,7 +302,7 @@ class Entry
|
|||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
|
|
|
@ -7,30 +7,33 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||
|
||||
/**
|
||||
* Users
|
||||
* User
|
||||
*
|
||||
* @ORM\Table(name="users")
|
||||
* @ORM\Table(name="user")
|
||||
* @ORM\Entity
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Users implements AdvancedUserInterface, \Serializable
|
||||
class User implements AdvancedUserInterface, \Serializable
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer", nullable=true)
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="username", type="text", nullable=true)
|
||||
* @ORM\Column(name="username", type="text")
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=32)
|
||||
*/
|
||||
private $salt;
|
||||
|
@ -38,7 +41,7 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="password", type="text", nullable=true)
|
||||
* @ORM\Column(name="password", type="text")
|
||||
*/
|
||||
private $password;
|
||||
|
||||
|
@ -61,12 +64,39 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
*/
|
||||
private $isActive;
|
||||
|
||||
/**
|
||||
* @var date
|
||||
*
|
||||
* @ORM\Column(name="created_at", type="datetime")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @var date
|
||||
*
|
||||
* @ORM\Column(name="updated_at", type="datetime")
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->isActive = true;
|
||||
$this->salt = md5(uniqid(null, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\PrePersist
|
||||
* @ORM\PreUpdate
|
||||
*/
|
||||
public function timestamps()
|
||||
{
|
||||
if (is_null($this->createdAt)) {
|
||||
$this->createdAt = new \DateTime();
|
||||
}
|
||||
|
||||
$this->updatedAt = new \DateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
|
@ -81,7 +111,7 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return Users
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
|
@ -120,7 +150,7 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return Users
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
@ -143,7 +173,7 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Users
|
||||
* @return User
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
@ -166,7 +196,7 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
* Set email
|
||||
*
|
||||
* @param string $email
|
||||
* @return Users
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
|
@ -185,6 +215,22 @@ class Users implements AdvancedUserInterface, \Serializable
|
|||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
Loading…
Reference in a new issue