3 namespace Wallabag\CoreBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use Symfony\Component\Security\Core\User\UserInterface
;
7 use Symfony\Component\Security\Core\User\EquatableInterface
;
8 use Symfony\Component\Security\Core\User\AdvancedUserInterface
;
13 * @ORM\Table(name="users")
16 class Users
implements AdvancedUserInterface
, \Serializable
21 * @ORM\Column(name="id", type="integer", nullable=true)
23 * @ORM\GeneratedValue(strategy="IDENTITY")
30 * @ORM\Column(name="username", type="text", nullable=true)
35 * @ORM\Column(type="string", length=32)
42 * @ORM\Column(name="password", type="text", nullable=true)
49 * @ORM\Column(name="name", type="text", nullable=true)
56 * @ORM\Column(name="email", type="text", nullable=true)
61 * @ORM\Column(name="is_active", type="boolean")
65 public function __construct()
67 $this->isActive
= true;
68 $this->salt
= md5(uniqid(null, true));
76 public function getId()
84 * @param string $username
87 public function setUsername($username)
89 $this->username
= $username;
99 public function getUsername()
101 return $this->username
;
107 public function getSalt()
115 public function getRoles()
117 return array('ROLE_USER');
123 * @param string $password
126 public function setPassword($password)
128 $this->password
= $password;
138 public function getPassword()
140 return $this->password
;
146 * @param string $name
149 public function setName($name)
161 public function getName()
169 * @param string $email
172 public function setEmail($email)
174 $this->email
= $email;
184 public function getEmail()
192 public function eraseCredentials()
197 * @see \Serializable::serialize()
199 public function serialize()
201 return serialize(array(
207 * @see \Serializable::unserialize()
209 public function unserialize($serialized)
213 ) = unserialize($serialized);
216 public function isEqualTo(UserInterface
$user)
218 return $this->username
=== $user->getUsername();
221 public function isAccountNonExpired()
226 public function isAccountNonLocked()
231 public function isCredentialsNonExpired()
236 public function isEnabled()
238 return $this->isActive
;